Fix "Signer 0x... is not a part of the producer set at block xxxx"

The validator set json loaded from database will have an empty map. This change will recompute the validator map based on validator set.
This commit is contained in:
Jerry 2022-07-25 10:17:22 -07:00
parent f184772b4d
commit c50ff82ab1
2 changed files with 6 additions and 0 deletions

View file

@ -59,6 +59,8 @@ func loadSnapshot(config *params.BorConfig, sigcache *lru.ARCCache, db ethdb.Dat
return nil, err
}
snap.ValidatorSet.UpdateValidatorMap()
snap.config = config
snap.sigcache = sigcache

View file

@ -628,6 +628,10 @@ func (vals *ValidatorSet) updateValidators(updates []*Validator, deletes []*Vali
vals.applyUpdates(updates)
vals.applyRemovals(deletes)
vals.UpdateValidatorMap()
}
func (vals *ValidatorSet) UpdateValidatorMap() {
vals.validatorsMap = make(map[common.Address]int, len(vals.Validators))
for i, val := range vals.Validators {