Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-cmdline.py
Show All 10 Lines | |||||
import re | import re | ||||
from test_framework.cdefs import LEGACY_MAX_BLOCK_SIZE | from test_framework.cdefs import LEGACY_MAX_BLOCK_SIZE | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal | from test_framework.util import assert_equal | ||||
MAX_GENERATED_BLOCK_SIZE_ERROR = ( | MAX_GENERATED_BLOCK_SIZE_ERROR = ( | ||||
'Max generated block size (blockmaxsize) cannot exceed the excessive block size (excessiveblocksize)') | 'Max generated block size \(blockmaxsize\) cannot exceed the excessive block size \(excessiveblocksize\)') | ||||
class ABC_CmdLine_Test (BitcoinTestFramework): | class ABC_CmdLine_Test (BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
Show All 20 Lines | def excessiveblocksize_test(self): | ||||
2 * LEGACY_MAX_BLOCK_SIZE)]) | 2 * LEGACY_MAX_BLOCK_SIZE)]) | ||||
self.check_excessive(2 * LEGACY_MAX_BLOCK_SIZE) | self.check_excessive(2 * LEGACY_MAX_BLOCK_SIZE) | ||||
# Check for EB correctness in the subver string | # Check for EB correctness in the subver string | ||||
self.check_subversion("/Bitcoin ABC:.*\(EB2\.0; .*\)/") | self.check_subversion("/Bitcoin ABC:.*\(EB2\.0; .*\)/") | ||||
self.log.info(" Attempt to set below legacy limit of 1MB - try {} bytes".format( | self.log.info(" Attempt to set below legacy limit of 1MB - try {} bytes".format( | ||||
LEGACY_MAX_BLOCK_SIZE)) | LEGACY_MAX_BLOCK_SIZE)) | ||||
self.stop_node(0) | self.stop_node(0) | ||||
self.assert_start_raises_init_error( | self.nodes[0].assert_start_raises_init_error( | ||||
0, ["-excessiveblocksize={}".format(LEGACY_MAX_BLOCK_SIZE)], | ["-excessiveblocksize={}".format(LEGACY_MAX_BLOCK_SIZE)], | ||||
'Error: Excessive block size must be > 1,000,000 bytes (1MB)') | 'Error: Excessive block size must be > 1,000,000 bytes \(1MB\)') | ||||
self.log.info(" Attempt to set below blockmaxsize (mining limit)") | self.log.info(" Attempt to set below blockmaxsize (mining limit)") | ||||
self.assert_start_raises_init_error( | self.nodes[0].assert_start_raises_init_error( | ||||
0, ['-blockmaxsize=1500000', '-excessiveblocksize=1300000'], 'Error: ' + MAX_GENERATED_BLOCK_SIZE_ERROR) | ['-blockmaxsize=1500000', '-excessiveblocksize=1300000'], 'Error: ' + MAX_GENERATED_BLOCK_SIZE_ERROR) | ||||
# Make sure we leave the test with a node running as this is what thee | # Make sure we leave the test with a node running as this is what thee | ||||
# framework expects. | # framework expects. | ||||
self.start_node(0, []) | self.start_node(0, []) | ||||
def run_test(self): | def run_test(self): | ||||
# Run tests on -excessiveblocksize option | # Run tests on -excessiveblocksize option | ||||
self.excessiveblocksize_test() | self.excessiveblocksize_test() | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
ABC_CmdLine_Test().main() | ABC_CmdLine_Test().main() |