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 { for key, i := range mask.PublicsIndex {
if enabled, err := mask.IndexEnabled(i); err == nil && enabled { if enabled, err := mask.IndexEnabled(i); err == nil && enabled {
currentTotal = currentTotal.Add( if voter, ok := v.roster.Voters[key]; ok {
v.roster.Voters[key].OverallPercent, currentTotal = currentTotal.Add(
) voter.OverallPercent,
)
}
} }
} }
return &currentTotal return &currentTotal

Loading…
Cancel
Save