Test RandomX RPC activation boundary

This commit is contained in:
Capri 2026-09-16 18:35:52 +00:00
commit 7413884a7a
Signed by: VextaProject
SSH key fingerprint: SHA256:739BZv8LvIDY2tR7lXLy/IQ6MaGTQtYcG9GNvCjmpVM

View file

@ -69,6 +69,13 @@ class RandomXGetBlockTemplateTest(DigiByteTestFramework):
"invalid", "invalid",
) )
self.log.info("Blockchain RPC reports only SHA256D before activation")
difficulty_info = node.getdifficulty()
assert_equal(set(difficulty_info["difficulties"]), {"sha256d"})
blockchain_info = node.getblockchaininfo()
assert_equal(set(blockchain_info["difficulties"]), {"sha256d"})
self.log.info("Mining algorithm bits override -blockversion algo bits") self.log.info("Mining algorithm bits override -blockversion algo bits")
block_version = 0x200000ff block_version = 0x200000ff
self.restart_node(0, extra_args=[f"-blockversion={block_version}"]) self.restart_node(0, extra_args=[f"-blockversion={block_version}"])
@ -85,6 +92,19 @@ class RandomXGetBlockTemplateTest(DigiByteTestFramework):
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]
self.log.info("Blockchain RPC exposes RandomX exactly at activation height")
difficulty_info = node.getdifficulty()
assert_equal(
set(difficulty_info["difficulties"]),
{"sha256d", "randomx"},
)
blockchain_info = node.getblockchaininfo()
assert_equal(
set(blockchain_info["difficulties"]),
{"sha256d", "randomx"},
)
self.log.info("RandomX GBT is available exactly at activation height") self.log.info("RandomX GBT is available exactly at activation height")
randomx_template = node.getblocktemplate( randomx_template = node.getblocktemplate(
NORMAL_GBT_REQUEST_PARAMS, NORMAL_GBT_REQUEST_PARAMS,