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
2025-09-18 09:00:31 -04:00
parent 74fa028da1
commit cad9a7fd73
2 changed files with 22 additions and 7 deletions

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