Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-sigops-mempool-mining.py
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.log.info( | self.log.info( | ||||
"But, a regular 1 sat/byte transaction can't get in now.") | "But, a regular 1 sat/byte transaction can't get in now.") | ||||
spendfrom = self.spendable_outputs.popleft() | spendfrom = self.spendable_outputs.popleft() | ||||
assert_raises_rpc_error(-26, "mempool min fee not met", node.sendrawtransaction, | assert_raises_rpc_error(-26, "mempool min fee not met", node.sendrawtransaction, | ||||
ToHex(create_var_transaction(spendfrom, b'', 500, 500))) | ToHex(create_var_transaction(spendfrom, b'', 500, 500))) | ||||
self.log.info( | self.log.info( | ||||
"Broadcasting regular transactions will push out the high-sigops txns.") | "Broadcasting regular transactions will push out the high-sigops txns.") | ||||
# We can broadcast a bunch of regular txes. They need to pay a bit more fee (1.5 sat/vbyte) than the floor. | # We can broadcast a bunch of regular txes. They need to pay a bit more | ||||
# fee (1.5 sat/vbyte) than the floor. | |||||
for i in range(15): | for i in range(15): | ||||
spendfrom = self.spendable_outputs.popleft() | spendfrom = self.spendable_outputs.popleft() | ||||
ctx = create_var_transaction(spendfrom, b'', 100000, 150000) | ctx = create_var_transaction(spendfrom, b'', 100000, 150000) | ||||
settxids.add(node.sendrawtransaction(ToHex(ctx))) | settxids.add(node.sendrawtransaction(ToHex(ctx))) | ||||
self.log.info("Mining picks all the 'good' txes first") | self.log.info("Mining picks all the 'good' txes first") | ||||
# These slightly higher-fee transactions also have more priority. | # These slightly higher-fee transactions also have more priority. | ||||
[lastblockhash, ] = node.generate(1) | [lastblockhash, ] = node.generate(1) | ||||
blocktxes = set(node.getblock(lastblockhash, 1)['tx']) | blocktxes = set(node.getblock(lastblockhash, 1)['tx']) | ||||
assert_equal(settxids.difference(blocktxes), set()) | assert_equal(settxids.difference(blocktxes), set()) | ||||
# there are still hundreds of the flooded txes left in mempool. | # there are still hundreds of the flooded txes left in mempool. | ||||
assert len(node.getrawmempool()) > 200 | assert len(node.getrawmempool()) > 200 | ||||
self.log.info( | self.log.info( | ||||
'PART 2: The following tests focus on mineability according to blockmintxfee.') | 'PART 2: The following tests focus on mineability according to blockmintxfee.') | ||||
self.log.info('Clear the mempool by mining out everything.') | self.log.info('Clear the mempool by mining out everything.') | ||||
node.generate(100) | node.generate(100) | ||||
assert_equal(node.getrawmempool(), []) | assert_equal(node.getrawmempool(), []) | ||||
self.log.info( | self.log.info( | ||||
'Reset the mempool fee floor (currently, restarting the node achieves this).') | 'Reset the mempool fee floor (currently, restarting the node achieves this).') | ||||
# could also be done by setting mocktime in future (the floor decays over a period of hours) | # could also be done by setting mocktime in future (the floor decays | ||||
# over a period of hours) | |||||
self.restart_node(0, self.extra_args[0]) | self.restart_node(0, self.extra_args[0]) | ||||
(node,) = self.nodes | (node,) = self.nodes | ||||
node.add_p2p_connection(P2PDataStore()) | node.add_p2p_connection(P2PDataStore()) | ||||
assert_equal(node.getmempoolinfo()[ | assert_equal(node.getmempoolinfo()[ | ||||
'mempoolminfee'], Decimal('0.00001000')) | 'mempoolminfee'], Decimal('0.00001000')) | ||||
self.log.info( | self.log.info( | ||||
'Get a 0.998 sat/byte transaction into mempool by having it mined then reorged out.') | 'Get a 0.998 sat/byte transaction into mempool by having it mined then reorged out.') | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |