Skip to content

Commit

Permalink
[staking] save owner list after PersistStakingPatchBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Oct 16, 2022
1 parent dc391ca commit 4ec42b4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions action/protocol/staking/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,10 @@ func (p *Protocol) handleCandidateRegister(ctx context.Context, act *action.Cand
if err := csm.Upsert(c); err != nil {
return log, nil, csmErrorToHandleError(owner.String(), err)
}
csm.DirtyView().candCenter.base.recordOwner(c)
height, _ := csm.SM().Height()
if p.needToWriteCandsMap(height) {
csm.DirtyView().candCenter.base.recordOwner(c)
}

// update bucket pool
if err := csm.DebitBucketPool(act.Amount(), true); err != nil {
Expand Down Expand Up @@ -762,7 +765,10 @@ func (p *Protocol) handleCandidateUpdate(ctx context.Context, act *action.Candid
if err := csm.Upsert(c); err != nil {
return log, csmErrorToHandleError(c.Owner.String(), err)
}
csm.DirtyView().candCenter.base.recordOwner(c)
height, _ := csm.SM().Height()
if p.needToWriteCandsMap(height) {
csm.DirtyView().candCenter.base.recordOwner(c)
}

log.AddAddress(actCtx.Caller)
return log, nil
Expand Down

0 comments on commit 4ec42b4

Please sign in to comment.