mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-11 23:30:05 +02:00
rpc: Always return per-wtxid entries in submitpackage tx-results
When submitpackage produced no per-transaction result for a member, the RPC previously set "error": "unevaluated" but then continued without inserting the entry into tx-results, making it impossible for callers to know which wtxids were unevaluated. Insert the placeholder result before continuing, update help text, and adjust functional tests to expect entries for all submitted wtxids.
This commit is contained in:
@@ -263,13 +263,23 @@ class RPCPackagesTest(BitcoinTestFramework):
|
||||
])
|
||||
|
||||
submitres = node.submitpackage([tx1["hex"], tx2["hex"], tx_child["hex"]])
|
||||
assert_equal(submitres, {'package_msg': 'conflict-in-package', 'tx-results': {}, 'replaced-transactions': []})
|
||||
expected = {
|
||||
tx1["wtxid"]: {"txid": tx1["txid"], "error": "package-not-validated"},
|
||||
tx2["wtxid"]: {"txid": tx2["txid"], "error": "package-not-validated"},
|
||||
tx_child["wtxid"]: {"txid": tx_child["txid"], "error": "package-not-validated"},
|
||||
}
|
||||
assert_equal(submitres, {"package_msg": "conflict-in-package", "tx-results": expected,"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': []})
|
||||
expected = {
|
||||
tx1["wtxid"]: {"txid": tx1["txid"], "error": "package-not-validated"},
|
||||
tx2["wtxid"]: {"txid": tx2["txid"], "error": "package-not-validated"},
|
||||
tx_child["wtxid"]: {"txid": tx_child["txid"], "error": "package-not-validated"},
|
||||
}
|
||||
assert_equal(submitres, {"package_msg": "conflict-in-package", "tx-results": expected,"replaced-transactions": []})
|
||||
assert tx_child["txid"] not in node.getrawmempool()
|
||||
|
||||
# without the in-mempool ancestor tx1 included in the call, tx2 can be submitted, but
|
||||
|
||||
Reference in New Issue
Block a user