aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-05-20 09:26:35 +0100
committerglozow <gloriajzhao@gmail.com>2024-05-20 09:27:37 +0100
commit063bb2fbb571b9ee4940dacbf56f36b15f6aa501 (patch)
tree07f9e556b38c4d60d90066a71c5017e326cf61c4 /test
parent058af75874ffa2b4064e3d6d30cc50f0ec754ba8 (diff)
parent9365baa489e123d9bcaf986e4311d3fa3f1e3f88 (diff)
downloadbitcoin-063bb2fbb571b9ee4940dacbf56f36b15f6aa501.tar.xz
Merge bitcoin/bitcoin#30066: test: add conflicting topology test case
9365baa489e123d9bcaf986e4311d3fa3f1e3f88 test: add conflicting topology test case (Greg Sanders) Pull request description: We want to ensure that even if topologies that are acceptable are relaxed, like removing package-not-child-with-unconfirmed-parents, that we don't end up accepting packages we shouldn't. ACKs for top commit: glozow: reACK 9365baa489 rkrux: reACK [9365baa](https://github.com/bitcoin/bitcoin/pull/30066/commits/9365baa489e123d9bcaf986e4311d3fa3f1e3f88) Tree-SHA512: d58661064ca099ac0447c331a5020c74c0cdfe24259aa875592805bbd63de1bf23aa7ced9ff485fef90dc0602fcb997e631aaf1aa2e9805d2cf5f0e5c9b2f0e2
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_packages.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/functional/rpc_packages.py b/test/functional/rpc_packages.py
index 8ac0afdaaa..113424c0a6 100755
--- a/test/functional/rpc_packages.py
+++ b/test/functional/rpc_packages.py
@@ -23,6 +23,7 @@ from test_framework.util import (
assert_raises_rpc_error,
)
from test_framework.wallet import (
+ COIN,
DEFAULT_FEE,
MiniWallet,
)
@@ -242,6 +243,37 @@ class RPCPackagesTest(BitcoinTestFramework):
{"txid": tx2["txid"], "wtxid": tx2["wtxid"], "package-error": "conflict-in-package"}
])
+ # Add a child that spends both at high feerate to submit via submitpackage
+ tx_child = self.wallet.create_self_transfer_multi(
+ fee_per_output=int(DEFAULT_FEE * 5 * COIN),
+ utxos_to_spend=[tx1["new_utxo"], tx2["new_utxo"]],
+ )
+
+ testres = node.testmempoolaccept([tx1["hex"], tx2["hex"], tx_child["hex"]])
+
+ assert_equal(testres, [
+ {"txid": tx1["txid"], "wtxid": tx1["wtxid"], "package-error": "conflict-in-package"},
+ {"txid": tx2["txid"], "wtxid": tx2["wtxid"], "package-error": "conflict-in-package"},
+ {"txid": tx_child["txid"], "wtxid": tx_child["wtxid"], "package-error": "conflict-in-package"}
+ ])
+
+ submitres = node.submitpackage([tx1["hex"], tx2["hex"], tx_child["hex"]])
+ assert_equal(submitres, {'package_msg': 'conflict-in-package', 'tx-results': {}, 'replaced-transactions': []})
+
+ # Submit tx1 to mempool, then try the same package again
+ node.sendrawtransaction(tx1["hex"])
+
+ submitres = node.submitpackage([tx1["hex"], tx2["hex"], tx_child["hex"]])
+ assert_equal(submitres, {'package_msg': 'conflict-in-package', 'tx-results': {}, 'replaced-transactions': []})
+ assert tx_child["txid"] not in node.getrawmempool()
+
+ # ... and without the in-mempool ancestor tx1 included in the call
+ submitres = node.submitpackage([tx2["hex"], tx_child["hex"]])
+ assert_equal(submitres, {'package_msg': 'package-not-child-with-unconfirmed-parents', 'tx-results': {}, 'replaced-transactions': []})
+
+ # Regardless of error type, the child can never enter the mempool
+ assert tx_child["txid"] not in node.getrawmempool()
+
def test_rbf(self):
node = self.nodes[0]