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 benjamin202410
parent 2cb1d3a340
commit 5004ef060a

View file

@ -20,14 +20,14 @@ import (
func AttachConsensusV2Hooks(adaptor *XDPoS.XDPoS, bc *core.BlockChain, chainConfig *params.ChainConfig) { func AttachConsensusV2Hooks(adaptor *XDPoS.XDPoS, bc *core.BlockChain, chainConfig *params.ChainConfig) {
// Hook scans for bad masternodes and decide to penalty them // 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() start := time.Now()
listBlockHash := []common.Hash{} listBlockHash := []common.Hash{}
// get list block hash & stats total created block // get list block hash & stats total created block
statMiners := make(map[common.Address]int) statMiners := make(map[common.Address]int)
listBlockHash = append(listBlockHash, currentHash) listBlockHash = append(listBlockHash, parentHash)
parentNumber := number.Uint64() - 1 parentNumber := number.Uint64() - 1
parentHash := currentHash currentHash := parentHash
// check and wait the latest block is already in the disk // check and wait the latest block is already in the disk
// sometimes blocks are yet inserted into block // sometimes blocks are yet inserted into block