aboutsummaryrefslogtreecommitdiff
path: root/test/functional/interface_rest.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-03-06 22:14:44 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-03-06 22:15:18 +0100
commitcd5e4381d46d01ca8282f02a18515e7b61de1dde (patch)
treedfcb265d1bac859d8fa0ed46db45ac6073573330 /test/functional/interface_rest.py
parent12ac2f0d7129151ec4c49be4061575dacb9199d4 (diff)
parent1dfb4e7d753e9282c89d55bde358b8ad96d3bfc2 (diff)
downloadbitcoin-cd5e4381d46d01ca8282f02a18515e7b61de1dde.tar.xz
Merge #12479: RPC: Add child transactions to getrawmempool verbose output
1dfb4e7d7 [Tests] Check output of parent/child tx list from getrawmempool, getmempooldescendants, getmempoolancestors, and REST interface (Conor Scott) fc44cb108 [RPC] Add list of child transactions to verbose output of getrawmempool (Conor Scott) Pull request description: `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" ] }, ``` Tree-SHA512: 83da7d421c9799a40ef65af3b7fdb586d6d87385f3f2ede3afd2c311725444b858f9d91cc110422a0fa31905779934fee07211ca6fe6b746792b83692c94b3ce
Diffstat (limited to 'test/functional/interface_rest.py')
-rwxr-xr-xtest/functional/interface_rest.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py
index 3e87f6d33f..8440f13a0d 100755
--- a/test/functional/interface_rest.py
+++ b/test/functional/interface_rest.py
@@ -296,8 +296,10 @@ class RESTTest (BitcoinTestFramework):
# check that there are our submitted transactions in the TX memory pool
json_string = http_get_call(url.hostname, url.port, '/rest/mempool/contents'+self.FORMAT_SEPARATOR+'json')
json_obj = json.loads(json_string)
- for tx in txs:
+ for i, tx in enumerate(txs):
assert_equal(tx in json_obj, True)
+ assert_equal(json_obj[tx]['spentby'], txs[i+1:i+2])
+ assert_equal(json_obj[tx]['depends'], txs[i-1:i])
# now mine the transactions
newblockhash = self.nodes[1].generate(1)