Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/abc-cmdline.py
Show All 39 Lines | class ABC_CmdLine_Test (BitcoinTestFramework): | ||||
def check_subversion(self, pattern_str): | def check_subversion(self, pattern_str): | ||||
'Check that the subversion is set as expected' | 'Check that the subversion is set as expected' | ||||
netinfo = self.nodes[0].getnetworkinfo() | netinfo = self.nodes[0].getnetworkinfo() | ||||
subversion = netinfo['subversion'] | subversion = netinfo['subversion'] | ||||
pattern = re.compile(pattern_str) | pattern = re.compile(pattern_str) | ||||
assert(pattern.match(subversion)) | assert(pattern.match(subversion)) | ||||
def excessiveblocksize_test(self): | def excessiveblocksize_test(self): | ||||
print("Testing -excessiveblocksize") | self.log.info("Testing -excessiveblocksize") | ||||
print(" Set to twice the default, i.e. %d bytes" % | self.log.info(" Set to twice the default, i.e. %d bytes" % | ||||
(2 * LEGACY_MAX_BLOCK_SIZE)) | (2 * LEGACY_MAX_BLOCK_SIZE)) | ||||
stop_node(self.nodes[0], 0) | stop_node(self.nodes[0], 0) | ||||
self.extra_args = [["-excessiveblocksize=%d" % | self.extra_args = [["-excessiveblocksize=%d" % | ||||
(2 * LEGACY_MAX_BLOCK_SIZE)]] | (2 * LEGACY_MAX_BLOCK_SIZE)]] | ||||
self.nodes[0] = start_node(0, self.options.tmpdir, | self.nodes[0] = start_node(0, self.options.tmpdir, | ||||
self.extra_args[0]) | self.extra_args[0]) | ||||
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\)/") | ||||
print(" Attempt to set below legacy limit of 1MB - try %d bytes" % | self.log.info(" Attempt to set below legacy limit of 1MB - try %d bytes" % | ||||
LEGACY_MAX_BLOCK_SIZE) | LEGACY_MAX_BLOCK_SIZE) | ||||
outputchecker = OutputChecker() | outputchecker = OutputChecker() | ||||
stop_node(self.nodes[0], 0) | stop_node(self.nodes[0], 0) | ||||
try: | try: | ||||
self.extra_args = [ | self.extra_args = [ | ||||
["-excessiveblocksize=%d" % LEGACY_MAX_BLOCK_SIZE]] | ["-excessiveblocksize=%d" % LEGACY_MAX_BLOCK_SIZE]] | ||||
self.nodes[0] = start_node(0, self.options.tmpdir, | self.nodes[0] = start_node(0, self.options.tmpdir, | ||||
self.extra_args[0], | self.extra_args[0], | ||||
stderr_checker=outputchecker) | stderr_checker=outputchecker) | ||||
except Exception as e: | except Exception as e: | ||||
assert(outputchecker.contains( | assert(outputchecker.contains( | ||||
'Error: Excessive block size must be > 1,000,000 bytes (1MB)')) | 'Error: Excessive block size must be > 1,000,000 bytes (1MB)')) | ||||
assert_equal( | assert_equal( | ||||
'bitcoind exited with status 1 during initialization', str(e)) | 'bitcoind exited with status 1 during initialization', str(e)) | ||||
else: | else: | ||||
raise AssertionError("Must not accept excessiveblocksize" | raise AssertionError("Must not accept excessiveblocksize" | ||||
" value < %d bytes" % LEGACY_MAX_BLOCK_SIZE) | " value < %d bytes" % LEGACY_MAX_BLOCK_SIZE) | ||||
print(" Attempt to set below blockmaxsize (mining limit)") | self.log.info(" Attempt to set below blockmaxsize (mining limit)") | ||||
outputchecker = OutputChecker() | outputchecker = OutputChecker() | ||||
try: | try: | ||||
self.extra_args = [['-blockmaxsize=1500000', | self.extra_args = [['-blockmaxsize=1500000', | ||||
'-excessiveblocksize=1300000']] | '-excessiveblocksize=1300000']] | ||||
self.nodes[0] = start_node(0, self.options.tmpdir, | self.nodes[0] = start_node(0, self.options.tmpdir, | ||||
self.extra_args[0], | self.extra_args[0], | ||||
stderr_checker=outputchecker) | stderr_checker=outputchecker) | ||||
except Exception as e: | except Exception as e: | ||||
Show All 19 Lines |