Skip to content

Commit

Permalink
feat(bpos): remove from NodeOwnerKeys when producer canceled
Browse files Browse the repository at this point in the history
  • Loading branch information
RainFallsSilent committed Oct 26, 2023
1 parent 159d8ab commit 2463368
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dpos/state/state.go
Expand Up @@ -1726,8 +1726,11 @@ func (s *State) processTransactions(txs []interfaces.Transaction, height uint32)
cancelDposV2AndDposV1V2Producer := func(key string, producer *Producer) {
oriState := producer.state
oriDepositAmount := producer.depositAmount
nodePublicKey := common.BytesToHexString(producer.info.NodePublicKey)
oriOwnerKey := s.NodeOwnerKeys[nodePublicKey]
s.History.Append(height, func() {
producer.state = Canceled
delete(s.NodeOwnerKeys, nodePublicKey)
producer.depositAmount -= state.MinDPoSV2DepositAmount
s.CanceledProducers[key] = producer
switch oriState {
Expand All @@ -1750,6 +1753,7 @@ func (s *State) processTransactions(txs []interfaces.Transaction, height uint32)
case Illegal:
s.IllegalProducers[key] = producer
}
s.NodeOwnerKeys[common.BytesToHexString(producer.info.NodePublicKey)] = oriOwnerKey
delete(s.CanceledProducers, key)
s.Nicknames[producer.info.NickName] = struct{}{}
})
Expand Down

0 comments on commit 2463368

Please sign in to comment.