Update totalDelegation if registered P-Rep has delegation
@@ -297,9 +297,11 @@ func (s *State) RegisterPRep(owner module.Address, ri *PRepInfo, irep *big.Int,
}
pb.SetIrep(irep, irepHeight)
+ if ps.Delegated().Sign() == 1 {
if err := s.SetTotalDelegation(new(big.Int).Add(s.GetTotalDelegation(), ps.Delegated())); err != nil {
return err
}
+ }
return nil
}
