-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Mempool refactor #3154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mempool refactor #3154
Conversation
|
Is it good / wise or just unneded to enable the -checkmempool with a normal node? Do we work towards enabling this as default in the future? Just want to get some insight on it :). |
|
Looks mostly OK. One issue: the locking for the mempool lookup inside ProcessMessage() seems to have changed. |
|
I like the idea of moving this out, but this doesn't really encapsulate it cleanly. A suggestion to obtain that:
|
|
@sipa +1 |
|
@sipa : good idea. |
|
@sipa Agreed. FWIW I wound up implementing a CTxMempool style thing myself when I was looking at doing a child-pays-for-parent mempool, so I think that's the right general direction to go in. |
|
Rebased and updated as per @sipa's suggestions. @jgarzik: locking has changed, but should be safer than before because there are many fewer cases of "reach inside and LOCK(mempool.cs)". I'd like to make the mempool critical section private, but I think that should be done in a future refactor (we will probably need a "give me a snapshot copy of the memory pool"; but that should wait until after implementing a memory-limited mempool, I think). |
src/main.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing this method to mempool.check() requires that you're holding cs_main. I'd feel safer documenting that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a comment about holding cs_main, and will note that when we switch to C++11 replacing it with lambda expressions will probably make sense.
|
ACK design and implementation. Haven't tested, and haven't checked that the moves are really move-only. |
|
An alternative and perhaps cleaner solution to passing the LookupFromTip pointer:
|
|
ACK I checked that the moves were all really move-only. |
|
Rebased, and renamed AcceptToMempool to AcceptToMemoryPool for consistency. @sipa: Moving CCoinsView/etc to core is non-trivial; CBlockIndex (at least) would have to move also. Lets save that for a future even-more-perfect refactor. |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/319b11607f8592d7ef67ec82fa73545ad7430974 for binaries and test log. |
I want to get these cleanups into master now to save work on merge conflicts later.
This mostly just moves mempool-related code from main.cpp to txmempool.{cpp,h}
There are a few small refactors: