Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
warning if node index isn't synced with SFC data
Browse files Browse the repository at this point in the history
  • Loading branch information
uprendis authored and quan8 committed Oct 12, 2020
1 parent 5a6f327 commit c5e06ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gossip/sfc_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ func (s *Service) processSfc(block *inter.Block, receipts types.Receipts, blockF
stakerID := idx.StakerID(new(big.Int).SetBytes(l.Topics[1][:]).Uint64())

staker := s.app.GetSfcStaker(stakerID)
if staker == nil {
s.Log.Warn("Internal SFC index isn't synced with SFC contract")
continue
}
staker.DeactivatedEpoch = epoch
staker.DeactivatedTime = block.Time
s.app.SetSfcStaker(stakerID, staker)
Expand All @@ -215,6 +219,10 @@ func (s *Service) processSfc(block *inter.Block, receipts types.Receipts, blockF
id := sfctype.DelegationID{address, stakerID}

delegation := s.app.GetSfcDelegation(id)
if delegation == nil {
s.Log.Warn("Internal SFC index isn't synced with SFC contract")
continue
}
staker := s.app.GetSfcStaker(stakerID)
if staker != nil {
staker.DelegatedMe.Sub(staker.DelegatedMe, delegation.Amount)
Expand Down

0 comments on commit c5e06ab

Please sign in to comment.