From 7e5d5965d12f4e110c026124ed326b03291fe469 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Thu, 31 Aug 2017 09:04:07 -0400 Subject: [PATCH 1/2] RPC: add wtxid to mempool entry output --- src/rpc/blockchain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index e6b78516e..9fb9a5cf3 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -343,6 +343,7 @@ std::string EntryDescriptionString() " \"ancestorcount\" : n, (numeric) number of in-mempool ancestor transactions (including this one)\n" " \"ancestorsize\" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one)\n" " \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one)\n" + " \"wtxid\" : hash, (string) hash of serialized transaction, including witness data\n" " \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n" " \"transactionid\", (string) parent transaction id\n" " ... ]\n"; @@ -363,6 +364,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) info.push_back(Pair("ancestorcount", e.GetCountWithAncestors())); info.push_back(Pair("ancestorsize", e.GetSizeWithAncestors())); info.push_back(Pair("ancestorfees", e.GetModFeesWithAncestors())); + info.push_back(Pair("wtxid", mempool.vTxHashes[e.vTxHashesIdx].first.ToString())); const CTransaction& tx = e.GetTx(); std::set setDepends; for (const CTxIn& txin : tx.vin) From 617c459c6c56911e70855dbe139ab095f435e73e Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Thu, 31 Aug 2017 13:18:35 -0400 Subject: [PATCH 2/2] qa: rpc test for wtxid in mempool entry --- test/functional/segwit.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/functional/segwit.py b/test/functional/segwit.py index 7bcb39301..1736cd10b 100755 --- a/test/functional/segwit.py +++ b/test/functional/segwit.py @@ -281,6 +281,9 @@ class SegWitTest(BitcoinTestFramework): assert(txid2 in template_txids) assert(txid3 in template_txids) + # Check that wtxid is properly reported in mempool entry + assert_equal(int(self.nodes[0].getmempoolentry(txid3)["wtxid"], 16), tx.calc_sha256(True)) + # Mine a block to clear the gbt cache again. self.nodes[0].generate(1)