-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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 limiting with descendant package tracking #6557
Conversation
9c7f7bc
to
8b15ff0
Compare
Concept ACK. It'll take me more time to go through the code. |
First #6201
|
@ABISprotocol please be constructive and help reviewing/testing this pull instead of criticizing, this isn't helping. |
As an alternative, TheBlueMatt@88a3b8d is much, much simpler (based on the first two commits from here). It is mostly untested, but should work well and doesnt have any obviously exploitable flaws as far as I know. Decendant package tracking and limiting should also be limited on top of it, but I really dont think mempool limiting itself needs to be this complicated. |
I really prefer to merge something simple first and work on more complex solution later on top of those initial changes, utACK to @TheBlueMatt 's alternative. That seems a path that is less conflicting with other related changes like simplifying free transaction's management or making the min relay fee dynamic, than blocking all the other changes while the more complex solution is not fully ready for whatever reason. |
NACK on TheBlueMatt/bitcoin@88a3b8d. I do however agree that mempool limiting doesn't have to be this complicated as long as we have the descendant package tracking/limiting first. |
Yea, turns out I was naive and didn't spend time to think about how sipa's removal code actually worked :/. I don't agree it's not trivial to appropriately limit it's runtime, but that's not so relevant since it doesn't with to begin with. In any case, my point was more that, yes, let's do descendant package tracking separately first, and then discuss how to do mempool limiting. On September 8, 2015 1:34:39 PM PDT, Alex Morcos notifications@github.com wrote:
|
Why not this one also: sipa@6498673 |
concept ACK, will review |
@dcousens TY |
Uses a notion of reserved space: The mempool will now have a soft cap set below its hard cap. After it fills up to the soft cap, transactions must first try using TrimMempool to evict the amount of size they are adding. If they fail they can still be let into the mempool if they pass a higher relay minimum. The minimum increases at every band between the soft cap and hard cap. Also implement a perioidic trim from reserve space: Use reserve space between soft cap and hard cap as a reservoir of surplus fees that have been paid above the minRelayTxFee and occasionally use the aggregate usage there to trim from the bottom of the mempool. This is based on earlier work by Pieter Wuille.
(note the 9x multiplier on (void*)'s for CTxMemPool::DynamicMemoryUsage was accidentally introduced in 5add7a7 but should have waited for this commit which adds the extra index)
37d3b8e
to
4c1404a
Compare
@morcos and I have reworked this pull, now that #6654 has been merged, to try to simplify the code. The overall approach is as follows:
There's also a commit here which will expire old transactions (default: 1 week) from the mempool. Still to do:
|
There are a few basic things that we should probably unify across mempool limiting pulls - how wallet is handled (calling a transaction "conflicted" (or rewording that a bit) if it gets dropped from mempool because it has too little fee is probably not a bad thing, IMO, especially when the obvious alternative is a deanonymization attack). On September 25, 2015 1:43:14 PM PDT, Suhas Daftuar notifications@github.com wrote:
|
I'm generally pleased to see where this has gone, however ~ these remarks intended for @sdaftuar and @morcos ~ I am interested in seeing the concerns inherent in my remarks here addressed as well as the statement clarifying that "mempool limiting and dynamic fee determination are superior to a static parameter change". To this end I am curious if there will be incorporated a floating relay fee ~ e.g., @sipa's sipa@6498673 ~ which was removed by @morcos from a prior iteration in the process of getting to this point. Shouldn't this (or something like it) be reincorporated at this point, or am I misunderstanding / jumping the gun? |
@ABISprotocol This PR effectively results in a floating relay fee, by not accepting lower fee transactions anymore as the mempool grows fuller, but without explicitly changing the "nMinRelayFee" variable. |
@ABISprotocol For the rest of your comments, the mailing list is probably better suited. |
@sipa TY |
@TheBlueMatt Agreed, the right wallet behavior should likely be the same regardless of which mempool limiting approach we take. I think this pull is now in good enough shape to try to digest, so that people who are interested can look at this, #6673, #6722, or any other suggestions that are proposed so that we we can pick an approach to focus on, which we can then try to refine. I am definitely curious if people have ideas about whether it's problematic for a wallet's transactions to not make it into the mempool in the first place, or get evicted from the mempool? Or if there are downsides to accepting one's own transactions into your mempool if you can only do so by bypassing the limiting logic? Regarding your CPFP comment, that seems like an interesting idea but I don't have a clear picture in my head of how that could actually be implemented. Seems like the tx relay logic would need to be reworked (along with the logic for not re-requesting rejected transactions), and I'm not sure what the logic would be of how to figure out which combinations of transaction bundles to try (the naive algorithm seems like it's n^2 in the length of the chain? maybe I'm missing something....). |
Unfortunately this needs a bit more work, so please don't do extensive code review yet. But in terms of strategy direction, still looking for input on this vs #6722 (and possibly vs #6673). Upcoming changes.
|
-----BEGIN PGP SIGNED MESSAGE----- Keep / focus on #6557. Alex Morcos:
iQEcBAEBCgAGBQJWCdqoAAoJEGxwq/inSG8CMOYH/3qihbcGRIWLdgvjTOBOWfhU |
Easier to more accurately account for surplus fees paid by txs in the reserve space.
Added two commits that address the points @morcos mentioned above. |
Closing in favor of #6722. |
This builds off #6470 by adding additional state to CTxMemPoolEntry to track the size/fees of a transaction with all its in-mempool descendants ("packages"), and then sorts the mempool based on
max(feerate of tx alone, feerate of tx with descendants)
, in order to improve the effectiveness of mempool limiting/eviction code.This introduces 4 new policy limits which serve the limit the length and size of chains in the mempool, in order to ensure computational feasibility of the calculations being done to track descendant packages and effectiveness of the mempool limiting algorithms. A detailed description of the changes made to the mempool as part of this pull can be found in
txmempool.h
.See also this email to the bitcoin-dev list, describing the policy limits proposed:
http://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-August/010221.html