-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Policy: Prepare AcceptToMemoryPool for encapsulated alternative replacement policies #6416
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
1e16a0a to
76a204e
Compare
107b4b0 to
1a9e990
Compare
1a9e990 to
2c9a88e
Compare
2c9a88e to
8dcae75
Compare
|
Updated with code from #6421. |
8dcae75 to
29f2bf1
Compare
|
@morcos here's #6449 on top of #6416 : https://github.com/jtimon/bitcoin/commits/morcos-6449-over-6416 Staging replacements and then remove them at the end of AcceptToMemoryPool in some way or another has been something that many people have tried, but working on alternatives to the "first seen" spend conflicts resolution policy was never a priority. Now it seems more priority than ever: apart from capping the mempool, we need some form of RBF so that people can bid up their transactions. |
29f2bf1 to
fe1c480
Compare
|
@morcos I would prefer to even go further with the preparations and move more things out of main, see https://github.com/jtimon/bitcoin/commits/policy-replacement-alt (which is closer to #6449 ), but I think it is unlikely that those kind of changes are welcomed for 0.11.1 (even thought it would mean that we can safely change AcceptToMemoryPool in 0.12.99 without having to worry about generating conflicts for a solution that can be backported to 0.11). What I'm trying to avoid is that other changes to AcceptToMemoryPool (of which I maintain many) get locked until 0.11.1, but maybe it's a lost cause... |
fe1c480 to
3501f19
Compare
…lock, and miner::CreateNewBlock and In all of them, reject transactions creating new money earlier. Consensus::CheckTxInputs gets nTxFee as output parameter and is separated from main::CheckInputs [renamed CheckInputsScripts] - Consensus::CheckTxInputs (called by the rest): Don't calculate nValueOut twice Don't check nFees < 0 twice - main::AcceptToMemoryPool: Don't call CCoinsViewCache::HaveInputs twice Don't calculate nValueIn 3 times Don't calculate nValueOut 5 times - miner::CreateNewBlock: Don't call CCoinsViewCache::HaveInputs twice Don't calculate nValueIn twice Don't calculate nValueOut 3 times - main::ConnectBlock: Still call CCoinsViewCache::HaveInputs twice Don't calculate nValueIn twice Don't calculate nValueOut 3 times
…xFee.GetFee(nSize)) condition
The following condition won't be checked anymore unless fLimitFree == true:
GetBoolArg("-relaypriority", true) && !AllowFree(view.GetPriority(tx, chainActive.Height() + 1))
3501f19 to
acb6575
Compare
With some code taken from Pieter Wuille's bitcoin#6421
acb6575 to
4c51b3f
Compare
As usual with policy changes, this could be cleaner after #6068, but I'd rather not wait anymore to propose this, which has been in my mind since #5071 (because I don't want policy to depend on txmempool).
It would be good that all alternative replacement policy proposals are built on top of this, since the encapsulation makes review easier. Feedback from people that have been working on alternative replacement policies (for example, @petertodd and @luke-jr ) or people that are working on the mempool is specially welcomed.
@morcos I'm thinking that the new CTxMemPool::addUnchecked that removes conflicts before inserting the new transaction may need some call the the fee estimator, but I'm not certain yet. What do you think?