Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore wallet read from json when present in env #174

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions cmd/gateway/zcn/initSDK.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,17 @@ func initializeSDK(configDir, allocid string, nonce int64, walletDetails string)
return err
}

walletFile := filepath.Join(configDir, "wallet.json")
var walletInfo string
if walletDetails == "" {
walletFile := filepath.Join(configDir, "wallet.json")

walletBytes, err := ioutil.ReadFile(walletFile)
if err != nil {
return err
walletBytes, err := ioutil.ReadFile(walletFile)
if err != nil {
return err
}
walletInfo = string(walletBytes)
} else {
walletInfo = walletDetails
}

logger.SyncLoggers([]*logger.Logger{zcncore.GetLogger(), sdk.GetLogger()})
Expand All @@ -97,10 +103,6 @@ func initializeSDK(configDir, allocid string, nonce int64, walletDetails string)
zcncore.SetLogLevel(3)
sdk.SetLogLevel(3)

walletInfo := string(walletBytes)
if walletDetails != "" {
walletInfo = walletDetails
}
err = client.InitSDK("{}", cfg.BlockWorker, cfg.ChainID, cfg.SignatureScheme, nonce, false, cfg.MinSubmit, cfg.MinConfirmation, cfg.ConfirmationChainLength, cfg.SharderConsensous)
if err != nil {
return err
Expand Down