Skip to content
Closed
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
11 changes: 6 additions & 5 deletions walletapi/daemon_communication.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ func test_connectivity() (err error) {
return
}

// Check for simulator first (simulator is neither mainnet nor testnet)
if strings.ToLower(info.Network) == "simulator" {
simulator = true
return nil
}

// detect whether both are in different modes
// daemon is in testnet and wallet in mainnet or
// daemon
Expand All @@ -168,11 +174,6 @@ func test_connectivity() (err error) {
logger.Error(err, "Mainnet/Testnet mismatch")
return
}

if strings.ToLower(info.Network) == "simulator" {
simulator = true
}

daemon_height = info.Height
daemon_topoheight = info.TopoHeight
// logger.Info("connection is maintained")
Expand Down
6 changes: 5 additions & 1 deletion walletapi/daemon_connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ func Connect(endpoint string) (err error) {
input_output := rwc.New(rpc_client.WS)
rpc_client.RPC = jrpc2.NewClient(channel.RawJSON(input_output, input_output), &jrpc2.ClientOptions{OnNotify: Notify_broadcaster})

return test_connectivity()
if err = test_connectivity(); err != nil {
Connected = false
return err
}
return nil
}

func GetRPCClient() *Client {
Expand Down
10 changes: 5 additions & 5 deletions walletapi/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type Account struct {
SeedLanguage string `json:"seedlanguage"`
FeesMultiplier float32 `json:"feesmultiplier"` // fees multiplier accurate to 2 decimals
Ringsize int `json:"ringsize"` // default mixn to use for txs
mainnet bool
Mainnet bool `json:"mainnet"`
Registered bool `json:"registered"`

Height uint64 `json:"height"` // block height till where blockchain has been scanned
Expand Down Expand Up @@ -223,7 +223,7 @@ func (account *Account) GetAddress() (addr rpc.Address) {
// convert a user account to address
func (w *Wallet_Memory) GetAddress() (addr rpc.Address) {
addr = w.account.GetAddress()
addr.Mainnet = w.account.mainnet
addr.Mainnet = w.account.Mainnet
return addr
}

Expand Down Expand Up @@ -427,12 +427,12 @@ func (w *Wallet_Memory) SetOfflineMode() bool {
}

func (w *Wallet_Memory) SetNetwork(mainnet bool) bool {
w.account.mainnet = mainnet
return w.account.mainnet
w.account.Mainnet = mainnet
return w.account.Mainnet
}

func (w *Wallet_Memory) GetNetwork() bool {
return w.account.mainnet
return w.account.Mainnet
}

// return current mode
Expand Down