Changeset View
Changeset View
Standalone View
Standalone View
test/functional/minchainwork.py
Show All 34 Lines | class MinimumChainWorkTest(BitcoinTestFramework): | ||||
def setup_network(self): | def setup_network(self): | ||||
# This test relies on the chain setup being: | # This test relies on the chain setup being: | ||||
# node0 <- node1 <- node2 | # node0 <- node1 <- node2 | ||||
# Before leaving IBD, nodes prefer to download blocks from outbound | # Before leaving IBD, nodes prefer to download blocks from outbound | ||||
# peers, so ensure that we're mining on an outbound peer and testing | # peers, so ensure that we're mining on an outbound peer and testing | ||||
# block relay to inbound peers. | # block relay to inbound peers. | ||||
self.setup_nodes() | self.setup_nodes() | ||||
for i in range(self.num_nodes-1): | for i in range(self.num_nodes-1): | ||||
connect_nodes(self.nodes[i+1], i) | connect_nodes(self.nodes[i+1], self.nodes[i]) | ||||
def run_test(self): | def run_test(self): | ||||
# Start building a chain on node0. node2 shouldn't be able to sync until node1's | # Start building a chain on node0. node2 shouldn't be able to sync until node1's | ||||
# minchainwork is exceeded | # minchainwork is exceeded | ||||
starting_chain_work = REGTEST_WORK_PER_BLOCK # Genesis block's work | starting_chain_work = REGTEST_WORK_PER_BLOCK # Genesis block's work | ||||
self.log.info( | self.log.info( | ||||
"Testing relay across node %d (minChainWork = %d)", 1, self.node_min_work[1]) | "Testing relay across node %d (minChainWork = %d)", 1, self.node_min_work[1]) | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |