|
23 | 23 | assert_raises_rpc_error,
|
24 | 24 | )
|
25 | 25 | from test_framework.wallet import (
|
| 26 | + COIN, |
26 | 27 | DEFAULT_FEE,
|
27 | 28 | MiniWallet,
|
28 | 29 | )
|
@@ -242,6 +243,37 @@ def test_conflicting(self):
|
242 | 243 | {"txid": tx2["txid"], "wtxid": tx2["wtxid"], "package-error": "conflict-in-package"}
|
243 | 244 | ])
|
244 | 245 |
|
| 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 | + |
245 | 277 | def test_rbf(self):
|
246 | 278 | node = self.nodes[0]
|
247 | 279 |
|
|
0 commit comments