Skip to content

Commit

Permalink
Merge rpc_mempoolentry_txhash
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Jul 30, 2018
3 parents 019bcb7 + ffb1810 + 228d67d commit e79db54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rpc/blockchain.cpp
Expand Up @@ -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"
Expand All @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/functional/feature_segwit.py
Expand Up @@ -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))

Expand Down

0 comments on commit e79db54

Please sign in to comment.