Make m_mempool optional in CChainState#22415
Conversation
518531e to
349ab28
Compare
|
Concept ACK. I think you can drop the second commit and add a RecursiveMutex* MempoolMutex() const LOCK_RETURNED(m_mempool->cs) { return m_mempool ? &m_mempool->cs : nullptr; }Seems to work for me in commit 8db5953 |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
349ab28 to
b17bb4c
Compare
|
Rebased to remove the second commit per Russ' suggestion, which also addresses most of Marco's feedback.
Wow, that was wizardly. Thanks @ryanofsky!
I'll look into this tomorrow. |
|
Light code review ACK b17bb4c37d58ca49e877983a632bfcaa493be993 |
maflcko
left a comment
There was a problem hiding this comment.
Nice solution with the LOCK_RETURNED
|
Concept ACK, will review on next push. |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK b17bb4c37d58ca49e877983a632bfcaa493be993
src/validation.cpp
Outdated
There was a problem hiding this comment.
In commit "validation: make CChainState::m_mempool optional" (b17bb4c37d58ca49e877983a632bfcaa493be993)
Note: It could be nice to be able to write AssertLockHeld(MempoolMutex() for consistency with LOCK(MempoolMutex()) and to avoid the if statement. But it'd be beyond scope of this PR since it'd require changing AssertLockHeld and there are other issues with that function anyway.
src/validation.cpp
Outdated
There was a problem hiding this comment.
In commit "validation: make CChainState::m_mempool optional" (b17bb4c37d58ca49e877983a632bfcaa493be993)
Note: Naively I'd expect the mempool pointer for the activated snapshot to be non-null, but I guess it could be set later when the snapshot is fully initialized.
There was a problem hiding this comment.
I was also surprised by this. Is the snapshot chainstate the one that eventually becomes our tip? In that case, don't we want it to have a mempool?
There was a problem hiding this comment.
Yeah, this is a little confusing absent context, but basically the idea per @ryanofsky's feedback is that mempool presence should be used to indicate chainstate activeness, so we don't want to give the snapshot chainstate a mempool until we consider it active.
b17bb4c to
8511429
Compare
|
Rebased.
This is a good point. I'd come up with a commit that implements the I've covered all of the other feedback aside from the lock assertion for the reasons Russ mentioned; maybe we can get around to it later. |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK 8511429f3bc480ddeef06c23810b3c47fa8513ee. Just some minor tweaks since last review: whitespace, unique_ptr assert, null mempool args
jonatack
left a comment
There was a problem hiding this comment.
ACK 8511429f3bc480ddeef06c23810b3c47fa8513ee code review, debug build, running bitcoind on signet as a sanity check, operation nominal
jnewbery
left a comment
There was a problem hiding this comment.
Concept ACK. A few non-blocking suggestions inline.
8511429 to
29acd85
Compare
|
Thanks for the prompt attention, good people. I've pushed a rebase that includes pretty much all of @jnewbery's feedback. This widens the scope of the PR to encompass a bit of refactoring, but I think it's all reasonable stuff to include here. |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK 29acd850fb0539b8358a451089ef7b1c583dd1a1. Simplifications from John make the change nicer.
29acd85 to
e34a992
Compare
|
Rebase to incorporate minor changes from @ryanofsky's feedback (#22415 (comment)). |
src/validation.cpp
Outdated
There was a problem hiding this comment.
I was also surprised by this. Is the snapshot chainstate the one that eventually becomes our tip? In that case, don't we want it to have a mempool?
jnewbery
left a comment
There was a problem hiding this comment.
Looking good. Just a few small comments inline.
e34a992 to
c13e832
Compare
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK c13e832af4a044a5c4beb4694022df53fa2eaf6d
|
@MarcoFalke would probably be most knowledgeable about the qemu-arm coredump #22415 (comment) https://cirrus-ci.com/task/6754077301276672?logs=ci#L3494, I was curious about that too. It seems like it is happening in a libsecp256k1 test so not related? But maybe there are ways to debug. (I don't want to bikeshed the style issues, since they don't actually matter at all. But just for fun I'll say I do agree with John in not liking mostly spurious |
|
The |
|
Could edit OP to remove the section that no longer applies to make sure it doesn't end up in the final merge commit? |
Since we now have multiple chainstate objects, only one of them is active at any given time. An active chainstate has a mempool, but there's no point to others having one. This change will simplify proposed assumeutxo semantics. See the discussion here: bitcoin#15606 (review) Co-authored-by: Russell Yanofsky <[email protected]>
Allows fewer arguments and simplification of call sites. Co-authored-by: John Newbery <[email protected]>
c13e832 to
8a38f35
Compare
|
Pushed a rebase:
|
Unnecessary argument since we can make use of this->m_mempool Co-authored-by: John Newbery <[email protected]>
Makes sense and saves on arguments. Co-authored-by: John Newbery <[email protected]>
8a38f35 to
ceb7b35
Compare
|
|
ACK ceb7b35 |
|
ACK ceb7b35 |
maflcko
left a comment
There was a problem hiding this comment.
review ACK ceb7b35 😌
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK ceb7b35a39145717e2d9d356fd382bd1f95d2a5a 😌
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhhlwwAtTlbDcsq2EyaUfR0ZvA00PHL6azSeUF1jZ0G0i3eTSVzYlATm+ePtd0W
wsJW4atryMHoqAGZeXTpjt8SZ9XqVdlylswiYefDVTmc9qq9T7ejW4uVtzY/sM45
D6jWRRSUg9xX8c7zrjRaxbPfdGonDTKxkh4BK3v1B9mm2+YVb5EjMDqszzsJs1ef
3VfWNwhRWmfLI9voCAIfOUzFQQC1dWI7NqS7V6MoTnEIpJouK34hvaA51un7iu38
ER5rUhmVUTT/VxkwbzlOlu4C654IVgAq4S2YQ0NWSIDgsuqxEe/C2nfUlm/bPl/v
Khu3jCJz9u26BCLOfkBEpftGUhhFK+djxgitDz/ktzD8taU6Fy2sDPp8vjL8cL3B
//Y87WELvtdUwDxBtqfxkkh+Yy7029uNm3n4Rh6Gex3dsAAZhWAaCKM/1uO1g2+9
KLFtb8sjMb57JQwG3Cdqs889JKjkUzeHdM52w9eu2WBQyWUhSAApuYsf1CUasjwS
I/SNB2Cz
=pjF5
-----END PGP SIGNATURE-----
Timestamp of file with hash 74406e84f80bcb1056122ddab2c038117cd73fd1e1a79cd5df1958eacc8b9b20 -

Make
CChainState::m_mempooloptional by making it a pointer instead of a reference. This will allow a simplification to assumeutxo semantics (see #15606 (review)) and help facilitate the-nomempooloption.