Page MenuHomePhabricator

RPC: Add child transactions to getrawmempool verbose output

Authored by Fabien on Jul 2 2019, 15:59.


bitcoin-cli getrawmempool true only lists a transaction's parents in the
depends field. This change adds a spentby field to the json response,
which lists the transaction's children in the mempool.

Currently the only way to find child transactions is to use
getrawmempool or make another call to getmempooldescendants and search
the response for transactions that list the parent_txid in the depends
list, which is inefficient.

This change allows direct lookup of children.

Example Output

  "9a9b5733c0d89f207908cfa3fe17809bee71f629aa095c9f8754524e29e98ba4": {
    ...other geterawmempool data...
    "depends": [
    "spentby": [

Backport of core PR12479

Test Plan
./test/functional/ interface_rest mempool_packages

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.