mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-26 17:52:13 +01:00
Merge bitcoin/bitcoin#24198: wallet, rpc: add wtxid in WalletTxToJSON
7abd8b21ba34f6a42db2cd2d59a4c0e08561f609 doc: include wtxid in TransactionDescriptionString (brunoerg) 2d596bce6fefeff6033b21b391e81f1dda846937 doc: add wtxid info in release-notes (brunoerg) a5b66738f19a0ad46d7bc287e0db08552c5a1fec test: add wtxid in expected_fields for wallet_basic (brunoerg) e8c659a2970ec8855de3e1dbf91c6b614b8e5644 wallet: add wtxid in WalletTxToJSON (brunoerg) 7482b6f89500d9783cc6af0dccab7a08d0128206 wallet: add GetWitnessHash() (brunoerg) Pull request description: This PR add `wtxid` in `WalletTxToJSON` which allows to return this field in `listsinceblock`, `listtransactions` and `gettransaction` (RPCs). ACKs for top commit: achow101: re-ACK 7abd8b21ba34f6a42db2cd2d59a4c0e08561f609 w0xlt: crACK 7abd8b2 luke-jr: re-utACK 7abd8b21ba34f6a42db2cd2d59a4c0e08561f609 Tree-SHA512: f86f2dbb5e38e7b19932006121802f47b759d31bdbffe3263d1db464f6a3a30fddd68416f886a44f6d3a9fd570f7bd4f8d999737ad95c189e7ae5e8ec1ffbdaa
This commit is contained in:
commit
9d22dbe2e1
6
doc/release-notes-24198.md
Normal file
6
doc/release-notes-24198.md
Normal file
@ -0,0 +1,6 @@
|
||||
Updated RPCs
|
||||
------------
|
||||
|
||||
- The `listtransactions`, `gettransaction`, and `listsinceblock`
|
||||
RPC methods now include a wtxid field (hash of serialized transaction,
|
||||
including witness data) for each transaction.
|
@ -34,6 +34,7 @@ static void WalletTxToJSON(const CWallet& wallet, const CWalletTx& wtx, UniValue
|
||||
}
|
||||
uint256 hash = wtx.GetHash();
|
||||
entry.pushKV("txid", hash.GetHex());
|
||||
entry.pushKV("wtxid", wtx.GetWitnessHash().GetHex());
|
||||
UniValue conflicts(UniValue::VARR);
|
||||
for (const uint256& conflict : wallet.GetTxConflicts(wtx))
|
||||
conflicts.push_back(conflict.GetHex());
|
||||
@ -431,6 +432,7 @@ static const std::vector<RPCResult> TransactionDescriptionString()
|
||||
{RPCResult::Type::NUM, "blockindex", /*optional=*/true, "The index of the transaction in the block that includes it."},
|
||||
{RPCResult::Type::NUM_TIME, "blocktime", /*optional=*/true, "The block time expressed in " + UNIX_EPOCH_TIME + "."},
|
||||
{RPCResult::Type::STR_HEX, "txid", "The transaction id."},
|
||||
{RPCResult::Type::STR_HEX, "wtxid", "The hash of serialized transaction, including witness data."},
|
||||
{RPCResult::Type::ARR, "walletconflicts", "Conflicting transaction ids.",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "txid", "The transaction id."},
|
||||
|
@ -296,6 +296,7 @@ public:
|
||||
bool isUnconfirmed() const { return !isAbandoned() && !isConflicted() && !isConfirmed(); }
|
||||
bool isConfirmed() const { return state<TxStateConfirmed>(); }
|
||||
const uint256& GetHash() const { return tx->GetHash(); }
|
||||
const uint256& GetWitnessHash() const { return tx->GetWitnessHash(); }
|
||||
bool IsCoinBase() const { return tx->IsCoinBase(); }
|
||||
|
||||
// Disable copying of CWalletTx objects to prevent bugs where instances get
|
||||
|
@ -668,7 +668,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
"category": baz["category"],
|
||||
"vout": baz["vout"]}
|
||||
expected_fields = frozenset({'amount', 'bip125-replaceable', 'confirmations', 'details', 'fee',
|
||||
'hex', 'time', 'timereceived', 'trusted', 'txid', 'walletconflicts'})
|
||||
'hex', 'time', 'timereceived', 'trusted', 'txid', 'wtxid', 'walletconflicts'})
|
||||
verbose_field = "decoded"
|
||||
expected_verbose_fields = expected_fields | {verbose_field}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user