-
Notifications
You must be signed in to change notification settings - Fork 38.8k
mempool janitor: periodic sweep and clean of not-confirming transactions #3753
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
Conversation
|
Self-note: does pwalletMain->IsMine() require a lock? I'm thinking yes. |
|
Why not use the term gc (garbage collection)? |
|
Nice, thanks. |
|
Good idea, ACK on concept. |
|
What has changed regarding bitcoin that is making this feature more necessary now where it wasn't so necessary in the past? |
|
@rebroad : we want to lower the relay fee, to give miners more opportunity to mine lower-fee transactions. But we don't want attackers to be able to gum up memory with lots of spammy, will-never-get-mined transactions... (and this is where Mike Hearn jumps in and points out, again, that we're doing it wrong and we should relay all transactions until we hit per-peer memory or bandwidth limits... and he is correct, but that is a lot more work). |
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'd rather have that the wallets let the mempool know that a transaction is precious (with a flag), than having the mempool manager poll the main wallet.
If you want to do it this way (poolman -> wallets) please use the RegisterWallet / UnregisterWallet machinery from main.cpp, and add a CWalletInterface method for this.
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.
Agree.
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.
poolbeing -> wallets
|
@Diapolo The name garbage collection is way, way too general. This cleans up the transactions in the pool, so pool manager is a good name. |
|
Pool boy. |
|
I believe the current implementation will remove unconfirmed dependencies of wallet transactions, transitively removing wallet transactions too. I'd prefer a flag bit in the mempool to mark transactions as precious, and when applied, it automatically propagates up to its dependencies. |
|
I also don't really like mempool (management) code needing to know about all connected wallets, and acquire locks on them. The mempool should function independently. |
|
Can't believe I registered for this. I'm with gmaxwell, "pool boy" is more appropriate. |
|
Why a separate thread? It could just run after receiving a new tx, I think? The more threads there are, the easier it is to slip up and slice your thumb off ... |
|
This operation is too slow and expensive to run after every new TX. |
|
The first step is to check if it's time to run, i.e. if now - lastTime > 24hrs. So I don't see what the issue is. |
|
@mikehearn Ah, I thought you were suggesting to run the operation after receipt of every TX. Yes, you could do it that way too. |
|
Rebased |
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.
You also need to remove everything that depends on a wallet transaction.
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.
Thank you
|
Please explain the merge conflict. |
src/init.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.
Can you ensure these new commands are alphabetically ordered in the help message list.
May I also suggest to add a DEFAULT_JANITORINTERVAL, DEFAULT_JANITOREXPIRE and use that here and in the GetArg(). It IMHO nice to use this in the help strings, because when changing a default we don't need to change the help string (and don't need to re-translate).
See e.g. -blockmaxsize= in init.cpp.
|
Rebased. The following feedback from @laanwj @sipa must be addressed before merge, If you want to do it this way (poolman -> wallets) please use the RegisterWallet / UnregisterWallet machinery from main.cpp, and add a CWalletInterface method for this." |
|
@jgarzik Thanks for your work on this! |
|
I just want to leave this as a comment rather than forking, pull requesting or any such-ness atm. I wanted to suggest that when this goes through to final at such point when rebase please consider the original remark I had some while back which was, I think, to rename from poolman.h to poolbeing.h, (see line 99 at src/Makefile.am for example). |
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.
Nit: Could you switch these two and place them above -listen please. Also @luke-jr A few weeks ago changed all strings in help messages to use strprintf(_()) as that makes life for translators easier.
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.
see notes on changes from poolman to poolbeing (languaging basically) above
|
What is a Poolbeing? Politically-correct nonsense which doesn't belong in bitcoin core is what. I vote Poolbot or Poolcleaner if you're so upset by the ending '-man' in the English language. |
|
Hi, my request for poolbeing was alluding for something beyond the standard anthropomorphic reference, and yes, that which ended in man. Not that I was upset by it, because I'm not, but I think that in light of the progress of technology today (consider for example DAOs) it makes more sense to have poolbeing. In light of your question, "what is a poolbeing," I would ask to you in return, "What is a poolman?" And there is nothing, because there is no poolman. The poolman is not there. We knock at the door, and he is not home. 'In Search of The Eternal Poolbeing' "Because of the one-pointed Time awareness in which the conventional mind remains immersed, humans tend to think of everything in a sequential, word-oriented framework. This mental trap produces very short-term concepts of effectiveness and consequences, a condition of constant, unplanned response to crises."
|
|
Not sure about the intention, but I always interpreted 'man' here as an
abbreviation for 'mamager'...
|
|
The command |
|
@ABISprotocol poolman is short for pool manager, manager is from the latin manus for hand, and has nothing to do with gender |
|
How to move forward here? (and I don't mean in regard to silly word games) |
|
Is expiration of mempool transactions on a fixed known schedule really the best solution? |
|
@laanwj The merge blocker with this pull request is a @sipa comment from long ago: The janitor must not sweep transactions which are "precious" to the local node. Generally this means wallet transactions. This is not a blocker for disabled-wallet configurations; thus two paths forward are,
@pstratem No. It is however a rough approximation of a solution that can be deployed today, modulo comments just made. The consensus on solution is a "superblock" type model, where
This real-time priority based culling is preferable to periodic garbage collection; however the "ideal solution" does not yet have any code or testing under its belt. poolman is an imperfect stopgap solution until The Ideal Solution arrives. |
|
For the wallet enabled mode, i think, if there would be a signal over CValidationInterface (something like |
|
@jgarzik well clearly this not a huge priority for merging (it's been sitting around for over a year now) modeling the mempool as a superblock seems reasonable, but is maybe too expensive to actually run everytime a new transaction is included. what do you think about simply removing the transaction (and it's dependents) with the lowest priority? |
|
@pstratem removing transaction(s) and dependents with lowest priority is not a good idea because low-priority dust (and/or transactions which exceed dust threshold but which are of lower priorities) should not be rejected due to the importance of inclusion of types of transactions to support a wide range of participants' needs, income ranges, and re-envisioning of dust as microgiving capacity or opportunity ( see my comments in #6402 - #1536 - #6201 ). |
|
Closing out older pull requests. This is not a judgement on this pull request or time-based expiration. Time-based mempool expiration continues to be the best way to sample what miners are not confirming. There is potential for resubmitting or reopening this in the future. |
The mempool janitor ("poolman") is a thread that runs every -janitorinterval
seconds. The janitor scans and removes memory pool transactions
older than current time minus -janitorexpire seconds.
By default, janitor runs every 24 hrs, expiring TXs older than 72 hrs [and have failed to make it into a block in that time].
IsMine() transactions are not touched.
This is intentionally crude: easily reviewed, reasoned and tested; fitting easily within the current framework, or being backported to an older bitcoind. A key goal was not rewriting mempool.
Comments:
This would work, but require a sort step, as mempool is not time-ordered. There is also the question of how often to run such a while{} loop, likely leading to some sort of high-water/low-water system.
The sweep implementation presented seemed more straightforward.