Skip to content

Commit cd3007d

Browse files
committed
fix: fixed public key management when split key mode is enabled
1 parent a410da3 commit cd3007d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

code/go/0chain.net/blobbercore/handler/protocol.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package handler
33
import (
44
"context"
55
"errors"
6+
"sync"
7+
68
"github.com/0chain/gosdk/core/client"
79
coreTxn "github.com/0chain/gosdk/core/transaction"
8-
"sync"
910

1011
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation"
1112
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/config"

code/go/0chain.net/core/node/self_node.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,25 @@ func (sn *SelfNode) SetKeys(clientKey, publicKey, privateKey string, isSplit boo
3838

3939
sn.wallet = &zcncrypto.Wallet{}
4040
sn.wallet.ClientID = Hash(publicKeyBytes)
41-
sn.wallet.ClientKey = publicKey
41+
42+
if isSplit {
43+
sn.wallet.ClientKey = clientKey
44+
} else {
45+
sn.wallet.ClientKey = publicKey
46+
}
47+
4248
sn.wallet.Keys = make([]zcncrypto.KeyPair, 1)
4349
sn.wallet.Keys[0].PublicKey = publicKey
4450
sn.wallet.Keys[0].PrivateKey = privateKey
4551
sn.wallet.Version = zcncrypto.CryptoVersion
4652
sn.wallet.IsSplit = isSplit
4753

48-
sn.PublicKey = publicKey
54+
if isSplit {
55+
sn.PublicKey = clientKey
56+
} else {
57+
sn.PublicKey = publicKey
58+
}
59+
4960
sn.ID = sn.wallet.ClientID
5061
}
5162

0 commit comments

Comments
 (0)