eth/hook: fix parameter mame mismatch in HookPenalties(), close XFN-141 (#1741)

This commit is contained in:
Daniel Liu 2025-11-18 20:19:18 +08:00 committed by GitHub
parent 6235de71ba
commit 627d77ae24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,14 +38,14 @@ type RewardLog struct {
func AttachConsensusV2Hooks(adaptor *XDPoS.XDPoS, bc *core.BlockChain, chainConfig *params.ChainConfig) {
// Hook scans for bad masternodes and decide to penalty them
adaptor.EngineV2.HookPenalty = func(chain consensus.ChainReader, number *big.Int, currentHash common.Hash, candidates []common.Address) ([]common.Address, error) {
adaptor.EngineV2.HookPenalty = func(chain consensus.ChainReader, number *big.Int, parentHash common.Hash, candidates []common.Address) ([]common.Address, error) {
start := time.Now()
listBlockHash := []common.Hash{}
// get list block hash & stats total created block
statMiners := make(map[common.Address]int)
listBlockHash = append(listBlockHash, currentHash)
listBlockHash = append(listBlockHash, parentHash)
parentNumber := number.Uint64() - 1
parentHash := currentHash
currentHash := parentHash
var round types.Round
// check and wait the latest block is already in the disk