From 51b99e40a84c1de38aeaa91f6f7ec1579a52b81c Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Mon, 5 Jan 2026 18:11:43 +0800 Subject: [PATCH] miner: fix block number extraction for BlockSigner tx (#1894) Previously, the code used binary.BigEndian.Uint64(data[8:40]), which incorrectly read the index and only extracted the highest 8 bytes of the 32-byte left-padded block number, resulting in wrong values (often zero). Now, the code uses new(big.Int).SetBytes(data[4:36]).Uint64() to correctly extract the block number from the proper 32-byte field. This change fixes both the incorrect index and the parsing logic, ensuring accurate block number extraction and correct validation for special transactions. --- miner/worker.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index cb0b66d1b0..d656282506 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -18,7 +18,6 @@ package miner import ( "bytes" - "encoding/binary" "errors" "fmt" "math/big" @@ -1020,7 +1019,7 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr log.Trace("Data special transaction invalid length", "hash", hash, "data", len(data)) continue } - blkNumber := binary.BigEndian.Uint64(data[8:40]) + blkNumber := new(big.Int).SetBytes(data[4:36]).Uint64() if blkNumber >= w.header.Number.Uint64() || blkNumber+w.config.XDPoS.Epoch*2 <= w.header.Number.Uint64() { log.Trace("Data special transaction invalid number", "hash", hash, "blkNumber", blkNumber, "miner", w.header.Number) continue