Skip to content

Commit 4ec42b4

Browse files
committed
[staking] save owner list after PersistStakingPatchBlock
1 parent dc391ca commit 4ec42b4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

action/protocol/staking/handlers.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,10 @@ func (p *Protocol) handleCandidateRegister(ctx context.Context, act *action.Cand
682682
if err := csm.Upsert(c); err != nil {
683683
return log, nil, csmErrorToHandleError(owner.String(), err)
684684
}
685-
csm.DirtyView().candCenter.base.recordOwner(c)
685+
height, _ := csm.SM().Height()
686+
if p.needToWriteCandsMap(height) {
687+
csm.DirtyView().candCenter.base.recordOwner(c)
688+
}
686689

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

767773
log.AddAddress(actCtx.Caller)
768774
return log, nil

0 commit comments

Comments
 (0)