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:
John Moffett committed 2025-09-19 10:29:00 -04:00
1 parent 74fa028da1
commit cad9a7fd73
2 files changed
+22 -7

No files matched your search

+12 -2
View File
@@ -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