Changeset View
Changeset View
Standalone View
Standalone View
test/functional/high_priority_transaction.py
Show All 9 Lines | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.mininode import COIN | from test_framework.mininode import COIN | ||||
from test_framework.cdefs import LEGACY_MAX_BLOCK_SIZE, COINBASE_MATURITY | from test_framework.cdefs import LEGACY_MAX_BLOCK_SIZE, COINBASE_MATURITY | ||||
class HighPriorityTransactionTest(BitcoinTestFramework): | class HighPriorityTransactionTest(BitcoinTestFramework): | ||||
def __init__(self): | def set_test_params(self): | ||||
super().__init__() | |||||
self.setup_clean_chain = True | |||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.extra_args = [["-blockprioritypercentage=0", "-limitfreerelay=2"]] | self.extra_args = [["-blockprioritypercentage=0", "-limitfreerelay=2"]] | ||||
def create_small_transactions(self, node, utxos, num, fee): | def create_small_transactions(self, node, utxos, num, fee): | ||||
addr = node.getnewaddress() | addr = node.getnewaddress() | ||||
txids = [] | txids = [] | ||||
for _ in range(num): | for _ in range(num): | ||||
t = utxos.pop() | t = utxos.pop() | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
self.log.info( | self.log.info( | ||||
"Assert that all high prio transactions haven't been mined") | "Assert that all high prio transactions haven't been mined") | ||||
assert_equal(self.nodes[0].getmempoolinfo()['bytes'], mempool_size_pre) | assert_equal(self.nodes[0].getmempoolinfo()['bytes'], mempool_size_pre) | ||||
# restart with default blockprioritypercentage | # restart with default blockprioritypercentage | ||||
self.stop_nodes() | self.stop_nodes() | ||||
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, | self.nodes = [] | ||||
[["-limitfreerelay=2"]]) | self.add_nodes(self.num_nodes, [["-limitfreerelay=2"]]) | ||||
self.start_nodes() | |||||
# second test step: default reserved prio space in block (100K). | # second test step: default reserved prio space in block (100K). | ||||
# the mempool size is about 25K this means that all txns will be | # the mempool size is about 25K this means that all txns will be | ||||
# included in the soon to be mined block | # included in the soon to be mined block | ||||
txids = self.generate_high_priotransactions(self.nodes[0], 150) | txids = self.generate_high_priotransactions(self.nodes[0], 150) | ||||
mempool_size_pre = self.nodes[0].getmempoolinfo()['bytes'] | mempool_size_pre = self.nodes[0].getmempoolinfo()['bytes'] | ||||
mempool = self.nodes[0].getrawmempool(True) | mempool = self.nodes[0].getrawmempool(True) | ||||
# assert that all the txns are in the mempool and that all of them are hiprio | # assert that all the txns are in the mempool and that all of them are hiprio | ||||
Show All 13 Lines |