Skip to content
Permalink
Browse files

Merge rpc_mempoolentry_txhash

  • Loading branch information...
luke-jr committed Jul 30, 2018
3 parents 019bcb7 + ffb1810 + 228d67d commit e79db541a04e18e979441da38cf0def8042ab5b2
Showing with 5 additions and 0 deletions.
  1. +2 −0 src/rpc/blockchain.cpp
  2. +3 −0 test/functional/feature_segwit.py
@@ -377,6 +377,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"
" \"hash\" : hash, (string) hash of entire serialized transaction\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"
@@ -401,6 +402,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("hash", mempool.vTxHashes[e.vTxHashesIdx].first.ToString()));
info.push_back(Pair("wtxid", mempool.vTxHashes[e.vTxHashesIdx].first.ToString()));
const CTransaction& tx = e.GetTx();
std::set<std::string> setDepends;
@@ -255,6 +255,9 @@ def run_test(self):
assert(txid2 in template_txids)
assert(txid3 in template_txids)

# Check that hash is properly reported in mempool entry
assert_equal(int(self.nodes[0].getmempoolentry(txid3)["hash"], 16), tx.calc_sha256(True))

# Check that wtxid is properly reported in mempool entry
assert_equal(int(self.nodes[0].getmempoolentry(txid3)["wtxid"], 16), tx.calc_sha256(True))

0 comments on commit e79db54

Please sign in to comment.
You can’t perform that action at this time.