prevent nil pointer crash

pull/3405/head
Rongjian Lan 4 years ago
parent 56d4bc2b1b
commit ceaf76e021
  1. 8
      consensus/quorum/one-node-staked-vote.go

@ -173,9 +173,11 @@ func (v *stakedVoteWeight) computeTotalPowerByMask(mask *bls_cosi.Mask) *numeric
for key, i := range mask.PublicsIndex {
if enabled, err := mask.IndexEnabled(i); err == nil && enabled {
currentTotal = currentTotal.Add(
v.roster.Voters[key].OverallPercent,
)
if voter, ok := v.roster.Voters[key]; ok {
currentTotal = currentTotal.Add(
voter.OverallPercent,
)
}
}
}
return &currentTotal

Loading…
Cancel
Save