Skip to content

Commit 7f3e9ff

Browse files
committed
use first private key as master key
1 parent 6a6b9ef commit 7f3e9ff

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

config/config.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,14 @@ func New(configPaths []string, _plugins []string, validates ...Validate) (Config
173173

174174
// set network master key to private key
175175
if cfg.Network.MasterKey == "" {
176-
if !cfg.System.Active {
176+
if cfg.System.Active {
177+
pks := cfg.Chain.ProducerPrivateKeys()
178+
if len(pks) > 0 {
179+
cfg.Network.MasterKey = pks[0].HexString()
180+
}
181+
}
182+
if cfg.Network.MasterKey == "" {
177183
cfg.Network.MasterKey = blockchain.GenerateRandomKey(blockchain.SigP256k1)
178-
} else {
179-
cfg.Network.MasterKey = cfg.Chain.ProducerPrivKey
180184
}
181185
}
182186

0 commit comments

Comments
 (0)