mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Merge bitcoin/bitcoin#24198: wallet, rpc: add wtxid in WalletTxToJSON
7abd8b21ba
doc: include wtxid in TransactionDescriptionString (brunoerg)2d596bce6f
doc: add wtxid info in release-notes (brunoerg)a5b66738f1
test: add wtxid in expected_fields for wallet_basic (brunoerg)e8c659a297
wallet: add wtxid in WalletTxToJSON (brunoerg)7482b6f895
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-ACK7abd8b21ba
w0xlt: crACK7abd8b2
luke-jr: re-utACK7abd8b21ba
Tree-SHA512: f86f2dbb5e38e7b19932006121802f47b759d31bdbffe3263d1db464f6a3a30fddd68416f886a44f6d3a9fd570f7bd4f8d999737ad95c189e7ae5e8ec1ffbdaa
This commit is contained in:
commit
9d22dbe2e1
4 changed files with 10 additions and 1 deletions
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…
Add table
Reference in a new issue