Few Minor per-utxo assert-semantics re-adds and tweak #10537
pull TheBlueMatt wants to merge 4 commits into bitcoin:master from TheBlueMatt:2017-06-per-utxo-fixes changing 5 files +22 −13-
TheBlueMatt commented at 0:23 am on June 6, 2017: memberOne small tweak which @sdaftuar commented and got missed, and two restore-previous-assert-semantics that I figured would be nice to re-add.
-
Remove useless mapNextTx lookup in CTxMemPool::TrimToSize.
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.
-
TheBlueMatt force-pushed on Jun 6, 2017
-
laanwj added the label UTXO Db and Indexes on Jun 6, 2017
-
gmaxwell commented at 9:53 am on June 6, 2017: contributorutACK (will test)
-
sipa commented at 0:37 am on June 9, 2017: memberutACK 743bdb5d52f7f7a0bcddfd55bccdac287140b491
-
in src/validation.cpp:1121 in 30a2265ac7 outdated
1117@@ -1118,7 +1118,8 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund 1118 txundo.vprevout.reserve(tx.vin.size()); 1119 BOOST_FOREACH(const CTxIn &txin, tx.vin) { 1120 txundo.vprevout.emplace_back(); 1121- inputs.SpendCoin(txin.prevout, &txundo.vprevout.back()); 1122+ bool fSpent = inputs.SpendCoin(txin.prevout, &txundo.vprevout.back());
ryanofsky commented at 3:09 pm on June 9, 2017:In commit “Return a bool in SpendCoin to restore pre-per-utxo assert semantics”
Maybe drop hungarian.
in src/consensus/tx_verify.cpp:126 in fc9fe49ba8 outdated
125@@ -126,7 +126,9 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& in 126 unsigned int nSigOps = 0;
ryanofsky commented at 3:12 pm on June 9, 2017: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?
TheBlueMatt commented at 4:09 pm on June 9, 2017: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).ryanofsky commented at 3:46 pm on June 9, 2017: memberutACK 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 inRemoveStaged
.TheBlueMatt force-pushed on Jun 9, 2017Return a bool in SpendCoin to restore pre-per-utxo assert semantics
Since its free to do so, assert that Spends succeeded when we expect them to.
Restore some assert semantics in sigop cost calculations
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).
Be much more agressive in AccessCoin docs.
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.
TheBlueMatt force-pushed on Jun 9, 2017ryanofsky commented at 5:27 pm on June 13, 2017: memberutACK 9417d7a336e71ee31ce673a6de5abb3d56941204. Has style guide fixes and the updated commit message.sipa commented at 1:17 am on June 21, 2017: memberutACK 9417d7a336e71ee31ce673a6de5abb3d56941204sipa merged this on Jun 21, 2017sipa closed this on Jun 21, 2017
sipa referenced this in commit b3eb0d6485 on Jun 21, 2017codablock referenced this in commit ab159b0c53 on Sep 27, 2017codablock referenced this in commit 066ce91851 on Oct 12, 2017codablock referenced this in commit b3f3191eba on Oct 26, 2017codablock referenced this in commit 16989c3d60 on Oct 26, 2017codablock referenced this in commit 4d742f5bee on Oct 26, 2017codablock referenced this in commit fad5bdcfc0 on Oct 30, 2017codablock referenced this in commit 0354804df2 on Oct 31, 2017codablock referenced this in commit 44a2ccb733 on Oct 31, 2017codablock referenced this in commit 151c552c71 on Oct 31, 2017UdjinM6 referenced this in commit d5c53d5c43 on Nov 8, 2017jasonbcox referenced this in commit 28c6e32e5d on Sep 13, 2019jonspock referenced this in commit 7564d05192 on Dec 22, 2019proteanx referenced this in commit 38f7d315f4 on Dec 23, 2019DrahtBot locked this on Sep 8, 2021
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me