This builds on #5206, removing the (now duplicate) check from AcceptToMemoryPool and makes mapNextTx private in CTxMemPool.
Make mapNextTx private within CTxMemPool #5347
pull TheBlueMatt wants to merge 4 commits into bitcoin:master from TheBlueMatt:mapnexttxpriv changing 7 files +74 −24-
TheBlueMatt commented at 10:21 PM on November 21, 2014: member
-
sipa commented at 11:35 AM on November 23, 2014: member
utACK; nice!
-
morcos commented at 6:04 PM on November 24, 2014: member
Sorry if I'm missing something, but why is it OK to remove the mapNextTx check? Where is the duplicate check? I ran a little test on this pull that sent a second transaction that reused an input, and the second tx was accepted to the memory pool and then caused an assertion to fail in mempool.check() at line 543 in txmempool.cpp.
-
morcos commented at 6:58 PM on November 24, 2014: member
I think the problem might be that in
CCoinsViewMemPool::GetCoins,mempool.pruneSpentis only called on coins returned from the mempool. But you can still return unpruned coins from the chain that have outputs spent by other transactions in the mempool. -
sipa commented at 7:02 PM on November 24, 2014: member
Nice catch!
- laanwj added the label Improvement on Nov 28, 2014
-
TheBlueMatt commented at 9:18 PM on November 30, 2014: member
Sure, just need to adapt GetCoins in CCoinsViewMemPool to call pruneSpent on non-mempool coins too, easy as pie :)
-
dgenr8 commented at 1:55 AM on December 1, 2014: contributor
You mean start using pcoinsTip so that it no longer represents the tip, but tip+mempool?
- TheBlueMatt force-pushed on Dec 21, 2014
-
TheBlueMatt commented at 2:10 AM on December 21, 2014: member
@dgenr8 No, like the middle commit I just pushed :p
-
TheBlueMatt commented at 2:44 AM on December 21, 2014: member
Also added a little mini-testcase to catch this case (and any simple mempool double-spend) just because :).
-
dgenr8 commented at 9:37 PM on December 21, 2014: contributor
@TheBlueMatt Ok. The mempool containing tx1 is the elusive "persistence mechanism" I was hung up on.
- TheBlueMatt force-pushed on Dec 22, 2014
-
TheBlueMatt commented at 2:26 AM on December 22, 2014: member
@dgenr8 heh, thanks...hadnt realized this failed :)
- laanwj added the label Tests on Jan 8, 2015
- laanwj added the label Mempool on Jan 8, 2015
-
morcos commented at 2:11 PM on March 20, 2015: member
Yes that problem was fixed. But my comment on the other PR still applies in that this changes behavior. As far as I could find the only change is in rpcsignrawtransaction and preventing signing of double spends (now also when the inputs are in the chain) and maybe that's ok? You can see this by switching the order of the
tx2 = ...andspend_id = ...lines in the included rpc test. Switching them will work prior to this change, but not with it. -
in qa/rpc-tests/mempool_reject_doublespend.py:None in cdbeae20c1 outdated
17 | +# Create one-input, one-output, no-fee transaction: 18 | +class MempoolSpendCoinbaseTest(BitcoinTestFramework): 19 | + 20 | + def setup_network(self): 21 | + # Just need one node for this test 22 | + args = ["-checkmempool", "-debug=mempool"]
morcos commented at 2:12 PM on March 20, 2015:needs "-relaypriority=0" or to create the tx with a fee.
TheBlueMatt commented at 10:57 AM on March 26, 2015:Fixed.
TheBlueMatt force-pushed on Mar 26, 2015laanwj commented at 10:06 PM on October 1, 2015: memberAny way forward on this? Or better to close for now?
TheBlueMatt commented at 12:41 AM on October 10, 2015: member93c7c3aba3CCoinsViewMemPool cleanup
Move the mempool lock into CCoinsViewMemPool, since the existing code always manually locks the mempool (with the lock having same lifetime as the view!). Move a call to CMempool::pruneSpent into CCoinsViewMemPool::GetCoins, since CCoinsViewMemPool::GetCoins is called only once in the codebase, followed by a call to pruneSpent with a `TODO` suggesting it be moved.
Move pruneSpent call to apply to non-mempool coins as well 4c904bf722Remove a dup check from AcceptToMemoryPool, make mapNextTx private d3cc9f8314Add basic mempool-reject-doublespend test 27662b4f1bTheBlueMatt force-pushed on Nov 5, 2015TheBlueMatt commented at 8:17 PM on November 5, 2015: memberI went ahead and rebased, in case anyone is interested in this, but the API change is maybe not great. Instead of being able to sign double-spends against unconfirmed txn freely, with this change you have to provide the inputs explicitly. Its not so hard to do, but maybe isnt such a nice API change.
TheBlueMatt closed this on Nov 5, 2015MarcoFalke locked this on Sep 8, 2021ContributorsLabels
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: 2026-04-22 06:15 UTC
More mirrored repositories can be found on mirror.b10c.me