Skip to content

Commit fc44cb1

Browse files
committed
[RPC] Add list of child transactions to verbose output of getrawmempool
1 parent 4528f74 commit fc44cb1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/rpc/blockchain.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ std::string EntryDescriptionString()
372372
" \"wtxid\" : hash, (string) hash of serialized transaction, including witness data\n"
373373
" \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n"
374374
" \"transactionid\", (string) parent transaction id\n"
375+
" ... ]\n"
376+
" \"spentby\" : [ (array) unconfirmed transactions spending outputs from this transaction\n"
377+
" \"transactionid\", (string) child transaction id\n"
375378
" ... ]\n";
376379
}
377380

@@ -406,6 +409,15 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
406409
}
407410

408411
info.pushKV("depends", depends);
412+
413+
UniValue spent(UniValue::VARR);
414+
const CTxMemPool::txiter &it = mempool.mapTx.find(tx.GetHash());
415+
const CTxMemPool::setEntries &setChildren = mempool.GetMemPoolChildren(it);
416+
for (const CTxMemPool::txiter &childiter : setChildren) {
417+
spent.push_back(childiter->GetTx().GetHash().ToString());
418+
}
419+
420+
info.pushKV("spentby", spent);
409421
}
410422

411423
UniValue mempoolToJSON(bool fVerbose)

0 commit comments

Comments
 (0)