diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-06-09 16:04:34 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-06-09 16:32:37 +0200 |
commit | 7ce9ac5c83b1844a518ef2e12e87aae3cacdfe58 (patch) | |
tree | 9fb09eefa8ed9886f52d3f0f46355aca4f632d11 /qa/rpc-tests/mempool_packages.py | |
parent | fd9881ae67824a843127d9177e4bc2188071f2c0 (diff) | |
parent | 176e19b571f722437043d2aa80a69ae21852c70d (diff) |
Merge #7292: [RPC] Expose ancestor/descendant information over RPC
176e19b Mention new RPC's in release notes (Suhas Daftuar)
7f6eda8 Add ancestor statistics to mempool entry RPC output (Suhas Daftuar)
a9b8390 Add test coverage for new RPC calls (Suhas Daftuar)
b09b813 Add getmempoolentry RPC call (Suhas Daftuar)
0dfd869 Add getmempooldescendants RPC call (Suhas Daftuar)
8f7b5dc Add getmempoolancestors RPC call (Suhas Daftuar)
5ec0cde Refactor logic for converting mempool entries to JSON (Suhas Daftuar)
Diffstat (limited to 'qa/rpc-tests/mempool_packages.py')
-rwxr-xr-x | qa/rpc-tests/mempool_packages.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/qa/rpc-tests/mempool_packages.py b/qa/rpc-tests/mempool_packages.py index 693ff593b3..45dc0e65c4 100755 --- a/qa/rpc-tests/mempool_packages.py +++ b/qa/rpc-tests/mempool_packages.py @@ -65,7 +65,14 @@ class MempoolPackagesTest(BitcoinTestFramework): descendant_fees = 0 descendant_size = 0 + descendants = [] + ancestors = list(chain) for x in reversed(chain): + # Check that getmempoolentry is consistent with getrawmempool + entry = self.nodes[0].getmempoolentry(x) + assert_equal(entry, mempool[x]) + + # Check that the descendant calculations are correct assert_equal(mempool[x]['descendantcount'], descendant_count) descendant_fees += mempool[x]['fee'] assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee']) @@ -74,6 +81,27 @@ class MempoolPackagesTest(BitcoinTestFramework): assert_equal(mempool[x]['descendantsize'], descendant_size) descendant_count += 1 + # Check that getmempooldescendants is correct + assert_equal(sorted(descendants), sorted(self.nodes[0].getmempooldescendants(x))) + descendants.append(x) + + # Check that getmempoolancestors is correct + ancestors.remove(x) + assert_equal(sorted(ancestors), sorted(self.nodes[0].getmempoolancestors(x))) + + # Check that getmempoolancestors/getmempooldescendants correctly handle verbose=true + v_ancestors = self.nodes[0].getmempoolancestors(chain[-1], True) + assert_equal(len(v_ancestors), len(chain)-1) + for x in v_ancestors.keys(): + assert_equal(mempool[x], v_ancestors[x]) + assert(chain[-1] not in v_ancestors.keys()) + + v_descendants = self.nodes[0].getmempooldescendants(chain[0], True) + assert_equal(len(v_descendants), len(chain)-1) + for x in v_descendants.keys(): + assert_equal(mempool[x], v_descendants[x]) + assert(chain[0] not in v_descendants.keys()) + # Check that descendant modified fees includes fee deltas from # prioritisetransaction self.nodes[0].prioritisetransaction(chain[-1], 0, 1000) |