Skip to content

Commit

Permalink
Merge pull request #1689 from 0chain/hotfix/update-onlykms
Browse files Browse the repository at this point in the history
Only update key if split key is enabled
  • Loading branch information
dabasov authored Nov 23, 2024
2 parents 9db58a2 + f0b5422 commit d4c44a6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zboxcore/sdk/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func (a *Allocation) generateAndSetOwnerSigningPublicKey() {
l.Logger.Error("Failed to generate owner signing key", zap.Error(err))
return
}
if a.OwnerSigningPublicKey == "" && !a.Finalized && !a.Canceled {
if a.OwnerSigningPublicKey == "" && !a.Finalized && !a.Canceled && client.Wallet().IsSplit {
pubKey := privateSigningKey.Public().(ed25519.PublicKey)
a.OwnerSigningPublicKey = hex.EncodeToString(pubKey)
hash, _, err := UpdateAllocation(0, false, a.ID, 0, "", "", "", a.OwnerSigningPublicKey, false, nil)
Expand All @@ -466,9 +466,11 @@ func (a *Allocation) generateAndSetOwnerSigningPublicKey() {
}
l.Logger.Info("Owner signing public key updated with transaction : ", hash, " ownerSigningPublicKey : ", a.OwnerSigningPublicKey)
a.Tx = hash
} else {
} else if a.OwnerSigningPublicKey != "" {
pubKey := privateSigningKey.Public().(ed25519.PublicKey)
l.Logger.Info("Owner signing public key already exists: ", a.OwnerSigningPublicKey, " generated: ", hex.EncodeToString(pubKey))
} else {
return
}
a.privateSigningKey = privateSigningKey
}
Expand Down

0 comments on commit d4c44a6

Please sign in to comment.