bitcoin/src/policy
fanquake f1a9fd627b
Merge bitcoin/bitcoin#28251: validation: fix coins disappearing mid-package evaluation
32c1dd1ad6 [test] mempool coins disappearing mid-package evaluation (glozow)
a67f460c3f [refactor] split setup in mempool_limit test (glozow)
d08696120e [test framework] add ability to spend only confirmed utxos (glozow)
3ea71feb11 [validation] don't LimitMempoolSize in any subpackage submissions (glozow)
d227b7234c [validation] return correct result when already-in-mempool tx gets evicted (glozow)
9698b81828 [refactor] back-fill results in AcceptPackage (glozow)
8ad7ad3392 [validation] make PackageMempoolAcceptResult members mutable (glozow)
03b87c11ca [validation] add AcceptSubPackage to delegate Accept* calls and clean up m_view (glozow)
3f01a3dab1 [CCoinsViewMemPool] track non-base coins and allow Reset (glozow)
7d7f7a1189 [policy] check for duplicate txids in package (glozow)

Pull request description:

  While we are evaluating a package, we split it into "subpackages" for evaluation (currently subpackages all have size 1 except the last one). If a subpackage has size 1, we may add a tx to mempool and call `LimitMempoolSize()`, which evicts transactions if the mempool gets full. We handle the case where the just-submitted transaction is evicted immediately, but we don't handle the case in which a transaction from a previous subpackage (either just submitted or already in mempool) is evicted. Mainly, since the coins created by the evicted transaction are cached in `m_view`, we don't realize the UTXO has disappeared until `CheckInputsFromMempoolAndCache` asserts that they exist. Also, the returned `PackageMempoolAcceptResult` reports that the transaction is in mempool even though it isn't anymore.

  Fix this by not calling `LimitMempoolSize()` until the very end, and editing the results map with "mempool full" if things fall out.

  Pointed out by instagibbs in faeed687e5 on top of the v3 PR.

ACKs for top commit:
  instagibbs:
    reACK 32c1dd1ad6

Tree-SHA512: 61e7f69db4712e5e5bfa27d037ab66bdd97f1bf60a8d9ffb96adb1f0609af012c810d681102ee5c7baec7b5fe8cb7c304a60c63ccc445d00d86a2b7f0e7ddb90
2023-09-13 17:51:00 +01:00
..
feerate.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
feerate.h feerate: For GetFeePerK() return nSatoshisPerK instead of round trip through GetFee 2023-06-19 14:36:14 -04:00
fees_args.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
fees_args.h refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
fees.cpp tx fees, policy: doc: update and delete unnecessary comment 2023-08-17 11:09:14 +01:00
fees.h tx fees, policy: doc: update and delete unnecessary comment 2023-08-17 11:09:14 +01:00
packages.cpp [policy] check for duplicate txids in package 2023-09-13 16:14:17 +01:00
packages.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
policy.cpp Rename script/standard.{cpp/h} to script/solver.{cpp/h} 2023-08-14 17:39:49 -04:00
policy.h Make post-p2sh consensus rules mandatory for tx relay 2023-08-18 00:59:27 +10:00
rbf.cpp Merge bitcoin/bitcoin#26289: Use util::Result in for calculating mempool ancestors 2023-01-03 16:30:55 -05:00
rbf.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
settings.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
settings.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00