Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/abc-cmdline.py
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | def excessiveblocksize_test(self): | ||||
(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" % | print(" Attempt to set below legacy limit of 1MB - try %d bytes" % | ||||
(LEGACY_MAX_BLOCK_SIZE - 1)) | 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 = [["-excessiveblocksize=%d" % | self.extra_args = [["-excessiveblocksize=%d" % LEGACY_MAX_BLOCK_SIZE]] | ||||
(LEGACY_MAX_BLOCK_SIZE - 1)]] | |||||
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('bitcoind exited with status 1 during initialization', str(e)) | assert_equal('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)") | print(" 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: | ||||
assert(outputchecker.contains( | assert(outputchecker.contains( | ||||
'Error: Max generated block size (blockmaxsize) cannot ' | 'Error: Max generated block size (blockmaxsize) cannot be ' | ||||
'exceed the excessive block size (excessiveblocksize)')) | 'lower than 1MB or exceed the excessive block size (excessiveblocksize)')) | ||||
assert_equal('bitcoind exited with status 1 during initialization', str(e)) | assert_equal('bitcoind exited with status 1 during initialization', str(e)) | ||||
else: | else: | ||||
raise AssertionError('Must not accept excessiveblocksize' | raise AssertionError('Must not accept excessiveblocksize' | ||||
' below blockmaxsize') | ' below blockmaxsize') | ||||
def run_test(self): | def run_test(self): | ||||
# Run tests on -excessiveblocksize option | # Run tests on -excessiveblocksize option | ||||
self.excessiveblocksize_test() | self.excessiveblocksize_test() | ||||
# Start up default because test framework expects running node | # Start up default because test framework expects running node | ||||
# at end of test. | # at end of test. | ||||
self.nodes[0] = start_node(0, self.options.tmpdir) | self.nodes[0] = start_node(0, self.options.tmpdir) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
ABC_CmdLine_Test().main() | ABC_CmdLine_Test().main() |