|
21 | 21 | fill_mempool,
|
22 | 22 | )
|
23 | 23 | from test_framework.wallet import (
|
| 24 | + COIN, |
24 | 25 | DEFAULT_FEE,
|
25 | 26 | MiniWallet,
|
26 | 27 | )
|
@@ -237,6 +238,37 @@ def test_conflicting(self):
|
237 | 238 | {"txid": tx2["txid"], "wtxid": tx2["wtxid"], "package-error": "conflict-in-package"}
|
238 | 239 | ])
|
239 | 240 |
|
| 241 | + # Add a child that spends both at high feerate to submit via submitpackage |
| 242 | + tx_child = self.wallet.create_self_transfer_multi( |
| 243 | + fee_per_output=int(DEFAULT_FEE * 5 * COIN), |
| 244 | + utxos_to_spend=[tx1["new_utxo"], tx2["new_utxo"]], |
| 245 | + ) |
| 246 | + |
| 247 | + testres = node.testmempoolaccept([tx1["hex"], tx2["hex"], tx_child["hex"]]) |
| 248 | + |
| 249 | + assert_equal(testres, [ |
| 250 | + {"txid": tx1["txid"], "wtxid": tx1["wtxid"], "package-error": "conflict-in-package"}, |
| 251 | + {"txid": tx2["txid"], "wtxid": tx2["wtxid"], "package-error": "conflict-in-package"}, |
| 252 | + {"txid": tx_child["txid"], "wtxid": tx_child["wtxid"], "package-error": "conflict-in-package"} |
| 253 | + ]) |
| 254 | + |
| 255 | + submitres = node.submitpackage([tx1["hex"], tx2["hex"], tx_child["hex"]]) |
| 256 | + assert_equal(submitres, {'package_msg': 'conflict-in-package', 'tx-results': {}, 'replaced-transactions': []}) |
| 257 | + |
| 258 | + # Submit tx1 to mempool, then try the same package again |
| 259 | + node.sendrawtransaction(tx1["hex"]) |
| 260 | + |
| 261 | + submitres = node.submitpackage([tx1["hex"], tx2["hex"], tx_child["hex"]]) |
| 262 | + assert_equal(submitres, {'package_msg': 'conflict-in-package', 'tx-results': {}, 'replaced-transactions': []}) |
| 263 | + assert tx_child["txid"] not in node.getrawmempool() |
| 264 | + |
| 265 | + # ... and without the in-mempool ancestor tx1 included in the call |
| 266 | + submitres = node.submitpackage([tx2["hex"], tx_child["hex"]]) |
| 267 | + assert_equal(submitres, {'package_msg': 'package-not-child-with-unconfirmed-parents', 'tx-results': {}, 'replaced-transactions': []}) |
| 268 | + |
| 269 | + # Regardless of error type, the child can never enter the mempool |
| 270 | + assert tx_child["txid"] not in node.getrawmempool() |
| 271 | + |
240 | 272 | def test_rbf(self):
|
241 | 273 | node = self.nodes[0]
|
242 | 274 |
|
|
0 commit comments