Page MenuHomePhabricator

RPC: Add child transactions to getrawmempool verbose output
ClosedPublic

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

Details

Summary
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...
    "wtxid":
"9a9b5733c0d89f207908cfa3fe17809bee71f629aa095c9f8754524e29e98ba4",
    "depends": [
      "bdd92851d5766a42aeb62af667bb422a116cab4e032bba5e3dd6efe5b4b40aa0"
    ],
    "spentby": [
      "dc5d3ec388a9121421208738a041ac30a22163bc2e17758f2275b6c51a15ba7b"
    ]
  },

Backport of core PR12479
https://github.com/bitcoin/bitcoin/pull/12479/files

Test Plan
./test/functional/test_runner.py interface_rest mempool_packages

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable