Skip to content

Commit

Permalink
fix change pubkey (optimization)
Browse files Browse the repository at this point in the history
  • Loading branch information
klim0v committed Sep 28, 2020
1 parent b0d1d43 commit a48d14a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 1 addition & 3 deletions core/state/candidates/candidates.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,9 +1026,7 @@ func (c *Candidates) ChangePubKey(old types.Pubkey, new types.Pubkey) {
panic("Candidate with such public key (" + new.String() + ") exists in block list")
}

candidate := c.getFromMap(old)
candidate.setPublicKey(new)
candidate.setTmAddress()
c.getFromMap(old).setPublicKey(new)
c.setBlockPubKey(old)
c.setPubKeyID(new, c.pubKeyIDs[old])
delete(c.pubKeyIDs, old)
Expand Down
1 change: 1 addition & 0 deletions core/state/candidates/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (candidate *Candidate) setControl(address types.Address) {
func (candidate *Candidate) setPublicKey(pubKey types.Pubkey) {
candidate.isDirty = true
candidate.PubKey = pubKey
candidate.setTmAddress()
}

func (candidate *Candidate) addUpdate(stake *stake) {
Expand Down

0 comments on commit a48d14a

Please sign in to comment.