consensus: fix delete the 1st validator from snapshot.recents list (#1344)
* consensus: fix delete the 1st validator from snapshot.recents list * consensus:fix uint sub error with negative
This commit is contained in:
parent
c11431e4ea
commit
c1fde0e86c
@ -1326,7 +1326,14 @@ func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Ad
|
||||
if p.chainConfig.IsPlanck(header.Number) {
|
||||
// reverse the key/value of snap.Recents to get recentsMap
|
||||
recentsMap := make(map[common.Address]uint64, len(snap.Recents))
|
||||
bound := uint64(0)
|
||||
if n, limit := header.Number.Uint64(), uint64(len(validators)/2+1); n > limit {
|
||||
bound = n - limit
|
||||
}
|
||||
for seen, recent := range snap.Recents {
|
||||
if seen <= bound {
|
||||
continue
|
||||
}
|
||||
recentsMap[recent] = seen
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user