diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-09-06 20:56:53 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-09-06 20:57:18 +0200 |
commit | d745b4cf7b0946184992d741b286bfdd28c68453 (patch) | |
tree | cf41d0033495d4943c1681c30ba9df3017f12bad | |
parent | 59e17899a762c08ce9a9edd7f464e884edbe8654 (diff) | |
parent | 617c459c6c56911e70855dbe139ab095f435e73e (diff) |
Merge #11203: rpc: add wtxid to mempool entry output
617c459c6 qa: rpc test for wtxid in mempool entry (Suhas Daftuar)
7e5d5965d RPC: add wtxid to mempool entry output (Suhas Daftuar)
Pull request description:
We already cache this information in the mempool, so including it in the output of rpc calls is basically free.
Tree-SHA512: 2757e1bfca028103937e4b76ce1a5d805846bad5d3d9dd631dcc5f87721bcc0e9d19e437e02053ef1dd3b38b503f0fca8c0b8492cac37dfbd70256a3665f704c
-rw-r--r-- | src/rpc/blockchain.cpp | 2 | ||||
-rwxr-xr-x | test/functional/segwit.py | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index ef61e5a55d..9fae9a7cd9 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<std::string> setDepends; for (const CTxIn& txin : tx.vin) diff --git a/test/functional/segwit.py b/test/functional/segwit.py index 609c592ed3..f465c1683b 100755 --- a/test/functional/segwit.py +++ b/test/functional/segwit.py @@ -279,6 +279,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) |