Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
block_worker: https://mainnet.zus.network/dns
block_worker: https://mainnet.zus.network/dns #override if local nodes are available
signature_scheme: bls0chain
min_submit: 50
min_confirmation: 50
Expand Down
17 changes: 15 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
"encoding/json"
"fmt"
"io/ioutil"
"net/http"

Check failure on line 8 in cmd/root.go

View workflow job for this annotation

GitHub Actions / Build-linux

"net/http" imported and not used

Check failure on line 8 in cmd/root.go

View workflow job for this annotation

GitHub Actions / unit-test

"net/http" imported and not used
"os"
"path/filepath"
"sync"
"time"

Check failure on line 12 in cmd/root.go

View workflow job for this annotation

GitHub Actions / Build-linux

"time" imported and not used

Check failure on line 12 in cmd/root.go

View workflow job for this annotation

GitHub Actions / unit-test

"time" imported and not used

"github.com/0chain/gosdk/core/client"
"github.com/0chain/gosdk/core/conf"
Expand All @@ -30,7 +32,6 @@
// If the fee is absent/low it is adjusted to the min fee required
// (acquired from miner) for the transaction to write into blockchain.
var gTxnFee float64

var clientConfig string
var minSubmit int
var minCfm int
Expand Down Expand Up @@ -100,6 +101,12 @@
ethereumNodeURL := cfgConfig.GetString("ethereum_node_url")
zauthServer := cfgConfig.GetString("zauth_server")

// If block_worker is empty, use a working DNS service for initialization
if blockWorker == "" {
fmt.Println("No block_worker specified, using mainnet DNS for initialization...")
blockWorker = "https://mainnet.zus.network/dns"
}

cfg := conf.Config{
BlockWorker: blockWorker,
SignatureScheme: signatureScheme,
Expand All @@ -113,7 +120,13 @@

err := client.Init(context.Background(), cfg)
if err != nil {
ExitWithError(err.Error())
ExitWithError("Failed to initialize client: " + err.Error())
}

// After successful initialization, override with local nodes if network.yaml exists
if cfgNetwork != nil {
fmt.Println("✓ Client initialized successfully")
fmt.Println("Local nodes from network.yaml will be used for transactions")
}
}

Expand Down
Loading