Skip to content
Open
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
5 changes: 4 additions & 1 deletion walletapi/daemon_communication.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var Connected bool = false
var daemon_height int64
var daemon_topoheight int64
var last_event_topoheight_tracked int64
var rpcCallTimeout = 10 * time.Second // per-call timeout preventing hangs on dead connections

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var rpcCallTimeout = 10 * time.Second // per-call timeout preventing hangs on dead connections
var RPCCallTimeout = 10 * time.Second // per-call timeout preventing hangs on dead connections; consumers may override


// return daemon height
func Get_Daemon_Height() int64 {
Expand Down Expand Up @@ -219,7 +220,9 @@ func (w *Wallet_Memory) sync_loop() {
}

func (cli *Client) Call(method string, params interface{}, result interface{}) error {
return cli.RPC.CallResult(context.Background(), method, params, result)
ctx, cancel := context.WithTimeout(context.Background(), rpcCallTimeout)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx, cancel := context.WithTimeout(context.Background(), rpcCallTimeout)
ctx, cancel := context.WithTimeout(context.Background(), RPCCallTimeout)

defer cancel()
return cli.RPC.CallResult(ctx, method, params, result)
}

// returns whether wallet was online some time ago
Expand Down