mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 13:02:38 +02:00
RPC: add transaction hash to mempool entry output
This commit is contained in:
parent
bbbf89a9de
commit
f72fb60b04
@ -261,6 +261,7 @@ static std::vector<RPCResult> MempoolEntryDescription()
|
||||
RPCResult{RPCResult::Type::NUM, "descendantsize", "virtual transaction size of in-mempool descendants (including this one)"},
|
||||
RPCResult{RPCResult::Type::NUM, "ancestorcount", "number of in-mempool ancestor transactions (including this one)"},
|
||||
RPCResult{RPCResult::Type::NUM, "ancestorsize", "virtual transaction size of in-mempool ancestors (including this one)"},
|
||||
RPCResult{RPCResult::Type::STR_HEX, "hash", "hash of entire serialized transaction"},
|
||||
RPCResult{RPCResult::Type::STR_HEX, "wtxid", "hash of serialized transaction, including witness data"},
|
||||
RPCResult{RPCResult::Type::OBJ, "fees", "",
|
||||
{
|
||||
@ -291,6 +292,7 @@ static void entryToJSON(const CTxMemPool& pool, UniValue& info, const CTxMemPool
|
||||
info.pushKV("ancestorcount", e.GetCountWithAncestors());
|
||||
info.pushKV("ancestorsize", e.GetSizeWithAncestors());
|
||||
info.pushKV("wtxid", pool.vTxHashes[e.vTxHashesIdx].first.ToString());
|
||||
info.pushKV("hash", info["wtxid"]);
|
||||
|
||||
UniValue fees(UniValue::VOBJ);
|
||||
fees.pushKV("base", ValueFromAmount(e.GetFee()));
|
||||
|
@ -283,7 +283,8 @@ class SegWitTest(BitcoinTestFramework):
|
||||
tx1_hex = self.nodes[0].gettransaction(txid1)['hex']
|
||||
tx1 = tx_from_hex(tx1_hex)
|
||||
|
||||
# Check that wtxid is properly reported in mempool entry (txid1)
|
||||
# Check that hash and wtxid are properly reported in mempool entry (txid1)
|
||||
assert_equal(int(self.nodes[0].getmempoolentry(txid1)["hash"], 16), tx1.calc_sha256(True))
|
||||
assert_equal(int(self.nodes[0].getmempoolentry(txid1)["wtxid"], 16), tx1.calc_sha256(True))
|
||||
|
||||
# Check that weight and vsize are properly reported in mempool entry (txid1)
|
||||
@ -299,7 +300,8 @@ class SegWitTest(BitcoinTestFramework):
|
||||
tx = tx_from_hex(tx2_hex)
|
||||
assert not tx.wit.is_null()
|
||||
|
||||
# Check that wtxid is properly reported in mempool entry (txid2)
|
||||
# Check that hash and wtxid are properly reported in mempool entry (txid2)
|
||||
assert_equal(int(self.nodes[0].getmempoolentry(txid2)["hash"], 16), tx.calc_sha256(True))
|
||||
assert_equal(int(self.nodes[0].getmempoolentry(txid2)["wtxid"], 16), tx.calc_sha256(True))
|
||||
|
||||
# Check that weight and vsize are properly reported in mempool entry (txid2)
|
||||
@ -322,7 +324,8 @@ class SegWitTest(BitcoinTestFramework):
|
||||
assert txid2 in template_txids
|
||||
assert txid3 in template_txids
|
||||
|
||||
# Check that wtxid is properly reported in mempool entry (txid3)
|
||||
# Check that hash and wtxid are properly reported in mempool entry (txid3)
|
||||
assert_equal(int(self.nodes[0].getmempoolentry(txid3)["hash"], 16), tx.calc_sha256(True))
|
||||
assert_equal(int(self.nodes[0].getmempoolentry(txid3)["wtxid"], 16), tx.calc_sha256(True))
|
||||
|
||||
# Check that weight and vsize are properly reported in mempool entry (txid3)
|
||||
|
Loading…
Reference in New Issue
Block a user