consensus: add isEpochSwitch check to IsSigner, close XFN-90 (#1654)

use current header to check IsSigner instead of parent header
This commit is contained in:
Wanwiset Peerapatanapokin 2025-11-10 21:54:51 +04:00 committed by GitHub
parent 3af629078a
commit 44b7ea8081
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -340,16 +340,7 @@ func New(stack *node.Node, config *ethconfig.Config, XDCXServ *XDCx.XDCX, lendin
hooks.AttachConsensusV2Hooks(c, eth.blockchain, chainConfig)
eth.txPool.IsSigner = func(address common.Address) bool {
currentHeader := eth.blockchain.CurrentHeader()
header := currentHeader
// Sometimes, the latest block hasn't been inserted to chain yet
// getSnapshot from parent block if it exists
parentHeader := eth.blockchain.GetHeader(currentHeader.ParentHash, currentHeader.Number.Uint64()-1)
if parentHeader != nil {
// not genesis block
header = parentHeader
}
return c.IsAuthorisedAddress(eth.blockchain, header, address)
return c.IsAuthorisedAddress(eth.blockchain, eth.blockchain.CurrentHeader(), address)
}
}