mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
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.
This commit is contained in:
parent
84ac794e22
commit
51b99e40a8
1 changed files with 1 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue