Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/smartfees.py
Show First 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | def setup_network(self): | ||||
# Now we can connect the other nodes, didn't want to connect them earlier | # Now we can connect the other nodes, didn't want to connect them earlier | ||||
# so the estimates would not be affected by the splitting transactions | # so the estimates would not be affected by the splitting transactions | ||||
# Node1 mines small blocks but that are bigger than the expected transaction rate, | # Node1 mines small blocks but that are bigger than the expected transaction rate, | ||||
# and allows free transactions. | # and allows free transactions. | ||||
# NOTE: the CreateNewBlock code starts counting block size at 1,000 bytes, | # NOTE: the CreateNewBlock code starts counting block size at 1,000 bytes, | ||||
# (17k is room enough for 110 or so transactions) | # (17k is room enough for 110 or so transactions) | ||||
self.nodes.append(start_node(1, self.options.tmpdir, | self.nodes.append(start_node(1, self.options.tmpdir, | ||||
["-blockprioritysize=1500", "-blockmaxsize=17000", | ["-blockprioritypercentage=9", "-blockmaxsize=17000", | ||||
"-maxorphantx=1000"], | "-maxorphantx=1000"], | ||||
stderr_checker=OutputChecker())) | stderr_checker=OutputChecker())) | ||||
connect_nodes(self.nodes[1], 0) | connect_nodes(self.nodes[1], 0) | ||||
# Node2 is a stingy miner, that | # Node2 is a stingy miner, that | ||||
# produces too small blocks (room for only 55 or so transactions) | # produces too small blocks (room for only 55 or so transactions) | ||||
node2args = ["-blockprioritysize=0", | node2args = ["-blockprioritypercentage=0", | ||||
"-blockmaxsize=8000", "-maxorphantx=1000"] | "-blockmaxsize=8000", "-maxorphantx=1000"] | ||||
self.nodes.append( | self.nodes.append( | ||||
start_node(2, self.options.tmpdir, node2args, stderr_checker=OutputChecker())) | start_node(2, self.options.tmpdir, node2args, stderr_checker=OutputChecker())) | ||||
connect_nodes(self.nodes[0], 2) | connect_nodes(self.nodes[0], 2) | ||||
connect_nodes(self.nodes[2], 1) | connect_nodes(self.nodes[2], 1) | ||||
self.sync_all() | self.sync_all() | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Finish by mining a normal-sized block: | # Finish by mining a normal-sized block: | ||||
while len(self.nodes[1].getrawmempool()) > 0: | while len(self.nodes[1].getrawmempool()) > 0: | ||||
self.nodes[1].generate(1) | self.nodes[1].generate(1) | ||||
sync_blocks(self.nodes[0:3], wait=.1) | sync_blocks(self.nodes[0:3], wait=.1) | ||||
self.log.info("Final estimates after emptying mempools") | self.log.info("Final estimates after emptying mempools") | ||||
check_estimates(self.nodes[1], self.fees_per_kb, 2) | check_estimates(self.nodes[1], self.fees_per_kb, 2) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
EstimateFeeTest().main() | EstimateFeeTest().main() |