diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-01-15 20:13:15 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-01-15 20:13:34 +0100 |
commit | 32e59fc371080def4b0be2adbe6486a4ba059972 (patch) | |
tree | 9508cead42d6a347ed89d202e725c33010d1d349 /src/rpc | |
parent | 0a1cf6c347348c48475de54c56f08827c9661901 (diff) | |
parent | fa0aa87071eaec8a5df17774cdb352195e5e09de (diff) |
Merge #20916: rpc: Return wtxid from testmempoolaccept
fa0aa87071eaec8a5df17774cdb352195e5e09de rpc: Return wtxid from testmempoolaccept (MarcoFalke)
Pull request description:
It would be nice if `testmempoolaccept` returned the unique wtxid directly to avoid a costly `decoderawtransaction` roundtrip
ACKs for top commit:
mjdietzx:
utACK fa0aa87071eaec8a5df17774cdb352195e5e09de
stackman27:
utACK [`fa0aa87`](https://github.com/bitcoin/bitcoin/pull/20916/commits/fa0aa87071eaec8a5df17774cdb352195e5e09de)
glozow:
cr ACK https://github.com/bitcoin/bitcoin/pull/20916/commits/fa0aa87071eaec8a5df17774cdb352195e5e09de
Tree-SHA512: 05dbaf46d93e47e9eedb725c2f57175e6d4e1722da0531fe4f80e74fc2518911da87634f25f61fa2bc8d87a3017e82fd0684b09a0a9706d71deed970035c2e7a
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/rawtransaction.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index e2897549b5..e94d554e3c 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -894,6 +894,7 @@ static RPCHelpMan testmempoolaccept() {RPCResult::Type::OBJ, "", "", { {RPCResult::Type::STR_HEX, "txid", "The transaction hash in hex"}, + {RPCResult::Type::STR_HEX, "wtxid", "The transaction witness hash in hex"}, {RPCResult::Type::BOOL, "allowed", "If the mempool allows this tx to be inserted"}, {RPCResult::Type::NUM, "vsize", "Virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted (only present when 'allowed' is true)"}, {RPCResult::Type::OBJ, "fees", "Transaction fees (only present if 'allowed' is true)", @@ -930,7 +931,6 @@ static RPCHelpMan testmempoolaccept() throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input."); } CTransactionRef tx(MakeTransactionRef(std::move(mtx))); - const uint256& tx_hash = tx->GetHash(); const CFeeRate max_raw_tx_fee_rate = request.params[1].isNull() ? DEFAULT_MAX_RAW_TX_FEE_RATE : @@ -942,7 +942,8 @@ static RPCHelpMan testmempoolaccept() UniValue result(UniValue::VARR); UniValue result_0(UniValue::VOBJ); - result_0.pushKV("txid", tx_hash.GetHex()); + result_0.pushKV("txid", tx->GetHash().GetHex()); + result_0.pushKV("wtxid", tx->GetWitnessHash().GetHex()); TxValidationState state; bool test_accept_res; |