mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
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:
parent
3af629078a
commit
44b7ea8081
1 changed files with 1 additions and 10 deletions
|
|
@ -340,16 +340,7 @@ func New(stack *node.Node, config *ethconfig.Config, XDCXServ *XDCx.XDCX, lendin
|
||||||
hooks.AttachConsensusV2Hooks(c, eth.blockchain, chainConfig)
|
hooks.AttachConsensusV2Hooks(c, eth.blockchain, chainConfig)
|
||||||
|
|
||||||
eth.txPool.IsSigner = func(address common.Address) bool {
|
eth.txPool.IsSigner = func(address common.Address) bool {
|
||||||
currentHeader := eth.blockchain.CurrentHeader()
|
return c.IsAuthorisedAddress(eth.blockchain, eth.blockchain.CurrentHeader(), address)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue