Clarify blockversion handling for multi-algo mining
This commit is contained in:
parent
cc320f4980
commit
9b76b2fa31
3 changed files with 15 additions and 2 deletions
|
|
@ -537,7 +537,7 @@ void SetupServerArgs(ArgsManager& argsman)
|
||||||
|
|
||||||
argsman.AddArg("-blockmaxweight=<n>", strprintf("Set maximum BIP141 block weight (default: %d)", DEFAULT_BLOCK_MAX_WEIGHT), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
argsman.AddArg("-blockmaxweight=<n>", strprintf("Set maximum BIP141 block weight (default: %d)", DEFAULT_BLOCK_MAX_WEIGHT), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
||||||
argsman.AddArg("-blockmintxfee=<amt>", strprintf("Set lowest fee rate (in %s/kvB) for transactions to be included in block creation. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_BLOCK_MIN_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
argsman.AddArg("-blockmintxfee=<amt>", strprintf("Set lowest fee rate (in %s/kvB) for transactions to be included in block creation. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_BLOCK_MIN_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
||||||
argsman.AddArg("-blockversion=<n>", "Override block version to test forking scenarios", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::BLOCK_CREATION);
|
argsman.AddArg("-blockversion=<n>", "Override block version bits to test forking scenarios; mining algorithm bits are set by the selected PoW algorithm", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::BLOCK_CREATION);
|
||||||
|
|
||||||
argsman.AddArg("-rest", strprintf("Accept public REST requests (default: %u)", DEFAULT_REST_ENABLE), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
|
argsman.AddArg("-rest", strprintf("Accept public REST requests (default: %u)", DEFAULT_REST_ENABLE), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
|
||||||
argsman.AddArg("-rpcallowip=<ip>", "Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
|
argsman.AddArg("-rpcallowip=<ip>", "Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ class MiningTest(DigiByteTestFramework):
|
||||||
block_version = 255 | VERSIONBITS_TOP_BITS
|
block_version = 255 | VERSIONBITS_TOP_BITS
|
||||||
self.restart_node(0, extra_args=[f'-mocktime={t}', '-blockversion={}'.format(block_version)])
|
self.restart_node(0, extra_args=[f'-mocktime={t}', '-blockversion={}'.format(block_version)])
|
||||||
self.connect_nodes(0, 1)
|
self.connect_nodes(0, 1)
|
||||||
assert_equal(block_version, self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version'])
|
expected_block_version = (block_version & ~(15 << 8)) | (2 << 8)
|
||||||
|
assert_equal(expected_block_version, self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version'])
|
||||||
self.restart_node(0, extra_args=[f'-mocktime={t}'])
|
self.restart_node(0, extra_args=[f'-mocktime={t}'])
|
||||||
self.connect_nodes(0, 1)
|
self.connect_nodes(0, 1)
|
||||||
assert_equal(671089154, self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version'])
|
assert_equal(671089154, self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version'])
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,18 @@ class RandomXGetBlockTemplateTest(DigiByteTestFramework):
|
||||||
"invalid",
|
"invalid",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.log.info("Mining algorithm bits override -blockversion algo bits")
|
||||||
|
block_version = 0x200000ff
|
||||||
|
self.restart_node(0, extra_args=[f"-blockversion={block_version}"])
|
||||||
|
node = self.nodes[0]
|
||||||
|
|
||||||
|
sha_template = node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)
|
||||||
|
expected_sha_version = (
|
||||||
|
(block_version & ~BLOCK_VERSION_ALGO) |
|
||||||
|
BLOCK_VERSION_SHA256D
|
||||||
|
)
|
||||||
|
assert_equal(sha_template["version"], expected_sha_version)
|
||||||
|
|
||||||
self.log.info("Activate RandomX at block 1 on regtest only")
|
self.log.info("Activate RandomX at block 1 on regtest only")
|
||||||
self.restart_node(0, extra_args=["-testactivationheight=randomx@1"])
|
self.restart_node(0, extra_args=["-testactivationheight=randomx@1"])
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue