From d2d358c45cb785d8ffe6118f30fc9f3375af8806 Mon Sep 17 00:00:00 2001 From: Capri Date: Wed, 16 Sep 2026 23:07:10 +0000 Subject: [PATCH] Test RandomX submitheader validation --- test/functional/mining_randomx_gbt.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/functional/mining_randomx_gbt.py b/test/functional/mining_randomx_gbt.py index 6c769aa..b7ce136 100755 --- a/test/functional/mining_randomx_gbt.py +++ b/test/functional/mining_randomx_gbt.py @@ -7,6 +7,7 @@ from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE_DESCRIPTOR from test_framework.blocktools import NORMAL_GBT_REQUEST_PARAMS +from test_framework.messages import CBlock, CBlockHeader, from_hex from test_framework.test_framework import DigiByteTestFramework from test_framework.util import assert_equal, assert_raises_rpc_error @@ -345,6 +346,22 @@ class RandomXGetBlockTemplateTest(DigiByteTestFramework): assert_equal(submit_node.getblockcount(), 0) + self.log.info("Submit the mixed SHA256D and RandomX headers first") + for height in range(1, 7): + block_hash = node.getblockhash(height) + raw_block = node.getblock(block_hash, 0) + block = from_hex(CBlock(), raw_block) + + assert_equal( + submit_node.submitheader( + CBlockHeader(block).serialize().hex() + ), + None, + ) + + assert_equal(submit_node.getblockcount(), 0) + + self.log.info("Submit the full blocks after their headers are known") for height in range(1, 7): block_hash = node.getblockhash(height) raw_block = node.getblock(block_hash, 0)