mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Merge #7292: [RPC] Expose ancestor/descendant information over RPC
176e19bMention new RPC's in release notes (Suhas Daftuar)7f6eda8Add ancestor statistics to mempool entry RPC output (Suhas Daftuar)a9b8390Add test coverage for new RPC calls (Suhas Daftuar)b09b813Add getmempoolentry RPC call (Suhas Daftuar)0dfd869Add getmempooldescendants RPC call (Suhas Daftuar)8f7b5dcAdd getmempoolancestors RPC call (Suhas Daftuar)5ec0cdeRefactor logic for converting mempool entries to JSON (Suhas Daftuar)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user