Skip to content

Commit 063bb2f

Browse files
committed
Merge bitcoin/bitcoin#30066: test: add conflicting topology test case
9365baa 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 9365baa rkrux: reACK [9365baa](bitcoin/bitcoin@9365baa) Tree-SHA512: d58661064ca099ac0447c331a5020c74c0cdfe24259aa875592805bbd63de1bf23aa7ced9ff485fef90dc0602fcb997e631aaf1aa2e9805d2cf5f0e5c9b2f0e2
2 parents 058af75 + 9365baa commit 063bb2f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/functional/rpc_packages.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
assert_raises_rpc_error,
2424
)
2525
from test_framework.wallet import (
26+
COIN,
2627
DEFAULT_FEE,
2728
MiniWallet,
2829
)
@@ -242,6 +243,37 @@ def test_conflicting(self):
242243
{"txid": tx2["txid"], "wtxid": tx2["wtxid"], "package-error": "conflict-in-package"}
243244
])
244245

246+
# Add a child that spends both at high feerate to submit via submitpackage
247+
tx_child = self.wallet.create_self_transfer_multi(
248+
fee_per_output=int(DEFAULT_FEE * 5 * COIN),
249+
utxos_to_spend=[tx1["new_utxo"], tx2["new_utxo"]],
250+
)
251+
252+
testres = node.testmempoolaccept([tx1["hex"], tx2["hex"], tx_child["hex"]])
253+
254+
assert_equal(testres, [
255+
{"txid": tx1["txid"], "wtxid": tx1["wtxid"], "package-error": "conflict-in-package"},
256+
{"txid": tx2["txid"], "wtxid": tx2["wtxid"], "package-error": "conflict-in-package"},
257+
{"txid": tx_child["txid"], "wtxid": tx_child["wtxid"], "package-error": "conflict-in-package"}
258+
])
259+
260+
submitres = node.submitpackage([tx1["hex"], tx2["hex"], tx_child["hex"]])
261+
assert_equal(submitres, {'package_msg': 'conflict-in-package', 'tx-results': {}, 'replaced-transactions': []})
262+
263+
# Submit tx1 to mempool, then try the same package again
264+
node.sendrawtransaction(tx1["hex"])
265+
266+
submitres = node.submitpackage([tx1["hex"], tx2["hex"], tx_child["hex"]])
267+
assert_equal(submitres, {'package_msg': 'conflict-in-package', 'tx-results': {}, 'replaced-transactions': []})
268+
assert tx_child["txid"] not in node.getrawmempool()
269+
270+
# ... and without the in-mempool ancestor tx1 included in the call
271+
submitres = node.submitpackage([tx2["hex"], tx_child["hex"]])
272+
assert_equal(submitres, {'package_msg': 'package-not-child-with-unconfirmed-parents', 'tx-results': {}, 'replaced-transactions': []})
273+
274+
# Regardless of error type, the child can never enter the mempool
275+
assert tx_child["txid"] not in node.getrawmempool()
276+
245277
def test_rbf(self):
246278
node = self.nodes[0]
247279

0 commit comments

Comments
 (0)