-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Few Minor per-utxo assert-semantics re-adds and tweak #10537
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
Prior to per-utxo CCoins, we checked that no other in-mempool tx spent any of the given transaction's outputs, as we don't want to uncache that entire tx in such a case. However, we now are checking only that there exists no other mempool spends of the same output, which should clearly be impossible after we removed the transaction which was spending said output (barring massive mempool inconsistency). Thanks to @sdaftuar for the suggestion.
05ae135 to
743bdb5
Compare
gmaxwell
left a comment
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.
utACK (will test)
|
utACK 743bdb5d52f7f7a0bcddfd55bccdac287140b491 |
ryanofsky
left a comment
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.
utACK 743bdb5d52f7f7a0bcddfd55bccdac287140b491
It took me a little while to decipher first commit, but just to put it in my own words, the map mapNextTx.count(txin.prevout) check that this PR removes would always returns 0 because you can't have two transactions in the mempool spending the same prevout, and the one transaction that had been spending it just got removed out a few lines previously in RemoveStaged.
src/validation.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.
In commit "Return a bool in SpendCoin to restore pre-per-utxo assert semantics"
Maybe drop hungarian.
src/consensus/tx_verify.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.
In commit "Restore some assert semantics in sigop cost calculations"
Maybe update commit message to suggest why policy/atmp asserts aren't added back. Not possible there, or just not worth the effort?
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 figured it wasn't worth it - if we hit those errors in consensus code, we'd better crash cause we might fall out of consensus...if we accidentally add something to our mempool that should be out of policy...oh well, not a big deal. (I updated commit message).
743bdb5 to
4cddd91
Compare
Since its free to do so, assert that Spends succeeded when we expect them to.
There are some similar asserts which are left removed in policy and ATMP (policy code being broken isn't a huge deal, but if we fail to verify some consensus rules, we should most definitely crash).
While the current implementation is pretty free, there is a lot of possibility for this to blow up in our face with future changes, especially as the backing map gets tweaked.
4cddd91 to
9417d7a
Compare
ryanofsky
left a comment
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.
utACK 9417d7a. Has style guide fixes and the updated commit message.
|
utACK 9417d7a |
9417d7a Be much more agressive in AccessCoin docs. (Matt Corallo) f58349c Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca
…tweak 9417d7a Be much more agressive in AccessCoin docs. (Matt Corallo) f58349c Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca
…tweak 9417d7a Be much more agressive in AccessCoin docs. (Matt Corallo) f58349c Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca
Summary: 9417d7a Be much more agressive in AccessCoin docs. (Matt Corallo) f58349c Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca Backport of Core PR10537 bitcoin/bitcoin#10537 Test Plan: make check test_runner.py Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3542
Summary: 9417d7a33 Be much more agressive in AccessCoin docs. (Matt Corallo) f58349ca8 Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4d3 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f2b Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca Backport of Core PR10537 bitcoin/bitcoin#10537 Test Plan: make check test_runner.py Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3542
Summary: 9417d7a33 Be much more agressive in AccessCoin docs. (Matt Corallo) f58349ca8 Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4d3 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f2b Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca Backport of Core PR10537 bitcoin/bitcoin#10537 Test Plan: make check test_runner.py Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3542
One small tweak which @sdaftuar commented and got missed, and two restore-previous-assert-semantics that I figured would be nice to re-add.