Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mempool_packages.py
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Check that getmempoolentry is consistent with getrawmempool | # Check that getmempoolentry is consistent with getrawmempool | ||||
entry = self.nodes[0].getmempoolentry(x) | entry = self.nodes[0].getmempoolentry(x) | ||||
assert_equal(entry, mempool[x]) | assert_equal(entry, mempool[x]) | ||||
# Check that the descendant calculations are correct | # Check that the descendant calculations are correct | ||||
assert_equal(mempool[x]['descendantcount'], descendant_count) | assert_equal(mempool[x]['descendantcount'], descendant_count) | ||||
descendant_fees += mempool[x]['fee'] | descendant_fees += mempool[x]['fee'] | ||||
assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee']) | assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee']) | ||||
assert_equal(mempool[x]['fees']['base'], mempool[x]['fee']) | |||||
assert_equal(mempool[x]['fees']['modified'], | |||||
mempool[x]['modifiedfee']) | |||||
assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN) | assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN) | ||||
assert_equal(mempool[x]['fees']['descendant'], descendant_fees) | |||||
descendant_size += mempool[x]['size'] | descendant_size += mempool[x]['size'] | ||||
assert_equal(mempool[x]['descendantsize'], descendant_size) | assert_equal(mempool[x]['descendantsize'], descendant_size) | ||||
descendant_count += 1 | descendant_count += 1 | ||||
# Check that ancestor calculations are correct | # Check that ancestor calculations are correct | ||||
assert_equal(mempool[x]['ancestorcount'], ancestor_count) | assert_equal(mempool[x]['ancestorcount'], ancestor_count) | ||||
assert_equal(mempool[x]['ancestorfees'], ancestor_fees * COIN) | assert_equal(mempool[x]['ancestorfees'], ancestor_fees * COIN) | ||||
assert_equal(mempool[x]['ancestorsize'], ancestor_size) | assert_equal(mempool[x]['ancestorsize'], ancestor_size) | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Check that ancestor modified fees includes fee deltas from | # Check that ancestor modified fees includes fee deltas from | ||||
# prioritisetransaction | # prioritisetransaction | ||||
self.nodes[0].prioritisetransaction(chain[0], 0, 1000) | self.nodes[0].prioritisetransaction(chain[0], 0, 1000) | ||||
mempool = self.nodes[0].getrawmempool(True) | mempool = self.nodes[0].getrawmempool(True) | ||||
ancestor_fees = 0 | ancestor_fees = 0 | ||||
for x in chain: | for x in chain: | ||||
ancestor_fees += mempool[x]['fee'] | ancestor_fees += mempool[x]['fee'] | ||||
assert_equal(mempool[x]['fees']['ancestor'], | |||||
ancestor_fees + Decimal('0.00001')) | |||||
assert_equal(mempool[x]['ancestorfees'], | assert_equal(mempool[x]['ancestorfees'], | ||||
ancestor_fees * COIN + 1000) | ancestor_fees * COIN + 1000) | ||||
# Undo the prioritisetransaction for later tests | # Undo the prioritisetransaction for later tests | ||||
self.nodes[0].prioritisetransaction(chain[0], 0, -1000) | self.nodes[0].prioritisetransaction(chain[0], 0, -1000) | ||||
# Check that descendant modified fees includes fee deltas from | # Check that descendant modified fees includes fee deltas from | ||||
# prioritisetransaction | # prioritisetransaction | ||||
self.nodes[0].prioritisetransaction(chain[-1], 0, 1000) | self.nodes[0].prioritisetransaction(chain[-1], 0, 1000) | ||||
mempool = self.nodes[0].getrawmempool(True) | mempool = self.nodes[0].getrawmempool(True) | ||||
descendant_fees = 0 | descendant_fees = 0 | ||||
for x in reversed(chain): | for x in reversed(chain): | ||||
descendant_fees += mempool[x]['fee'] | descendant_fees += mempool[x]['fee'] | ||||
assert_equal(mempool[x]['fees']['descendant'], | |||||
descendant_fees + Decimal('0.00001')) | |||||
assert_equal(mempool[x]['descendantfees'], | assert_equal(mempool[x]['descendantfees'], | ||||
descendant_fees * COIN + 1000) | descendant_fees * COIN + 1000) | ||||
# Adding one more transaction on to the chain should fail. | # Adding one more transaction on to the chain should fail. | ||||
assert_raises_rpc_error(-26, "too-long-mempool-chain", | assert_raises_rpc_error(-26, "too-long-mempool-chain", | ||||
self.chain_transaction, self.nodes[0], txid, vout, value, fee, 1) | self.chain_transaction, self.nodes[0], txid, vout, value, fee, 1) | ||||
# Check that prioritising a tx before it's added to the mempool works | # Check that prioritising a tx before it's added to the mempool works | ||||
Show All 12 Lines | def run_test(self): | ||||
mempool = self.nodes[0].getrawmempool(True) | mempool = self.nodes[0].getrawmempool(True) | ||||
descendant_fees = 0 | descendant_fees = 0 | ||||
for x in reversed(chain): | for x in reversed(chain): | ||||
descendant_fees += mempool[x]['fee'] | descendant_fees += mempool[x]['fee'] | ||||
if (x == chain[-1]): | if (x == chain[-1]): | ||||
assert_equal(mempool[x]['modifiedfee'], | assert_equal(mempool[x]['modifiedfee'], | ||||
mempool[x]['fee'] + satoshi_round(0.00002)) | mempool[x]['fee'] + satoshi_round(0.00002)) | ||||
assert_equal(mempool[x]['fees']['modified'], | |||||
mempool[x]['fee'] + satoshi_round(0.00002)) | |||||
assert_equal(mempool[x]['descendantfees'], | assert_equal(mempool[x]['descendantfees'], | ||||
descendant_fees * COIN + 2000) | descendant_fees * COIN + 2000) | ||||
assert_equal(mempool[x]['fees']['descendant'], | |||||
descendant_fees + satoshi_round(0.00002)) | |||||
# TODO: check that node1's mempool is as expected | # TODO: check that node1's mempool is as expected | ||||
# TODO: test ancestor size limits | # TODO: test ancestor size limits | ||||
# Now test descendant chain limits | # Now test descendant chain limits | ||||
txid = utxo[1]['txid'] | txid = utxo[1]['txid'] | ||||
value = utxo[1]['amount'] | value = utxo[1]['amount'] | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |