From 7247d0ae77ff6f05a63b7a18b015888a8e92f435 Mon Sep 17 00:00:00 2001 From: envestcc Date: Mon, 1 Jul 2024 11:23:15 +0800 Subject: [PATCH 1/2] candidate id collision check after HF --- action/protocol/staking/handlers.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/action/protocol/staking/handlers.go b/action/protocol/staking/handlers.go index 9b171d66cb..19c7cc9a62 100644 --- a/action/protocol/staking/handlers.go +++ b/action/protocol/staking/handlers.go @@ -699,12 +699,12 @@ func (p *Protocol) handleCandidateRegister(ctx context.Context, act *action.Cand } } candID = id - } - c = csm.GetByIdentifier(candID) - if c != nil { - return log, nil, &handleError{ - err: ErrInvalidOwner, - failureStatus: iotextypes.ReceiptStatus_ErrCandidateAlreadyExist, + c = csm.GetByIdentifier(candID) + if c != nil { + return log, nil, &handleError{ + err: ErrInvalidOwner, + failureStatus: iotextypes.ReceiptStatus_ErrCandidateAlreadyExist, + } } } // cannot collide with existing name From a11ed08d672a8ee4ea50c2eeba69617ea4b99bfd Mon Sep 17 00:00:00 2001 From: envestcc Date: Mon, 1 Jul 2024 14:40:34 +0800 Subject: [PATCH 2/2] fix --- action/protocol/staking/handlers.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/action/protocol/staking/handlers.go b/action/protocol/staking/handlers.go index 19c7cc9a62..8329b2149a 100644 --- a/action/protocol/staking/handlers.go +++ b/action/protocol/staking/handlers.go @@ -699,8 +699,7 @@ func (p *Protocol) handleCandidateRegister(ctx context.Context, act *action.Cand } } candID = id - c = csm.GetByIdentifier(candID) - if c != nil { + if csm.GetByIdentifier(candID) != nil { return log, nil, &handleError{ err: ErrInvalidOwner, failureStatus: iotextypes.ReceiptStatus_ErrCandidateAlreadyExist,