Skip to content

Commit

Permalink
Merge pull request #56 from abelium-rd/staging
Browse files Browse the repository at this point in the history
add reward UTXO request timeout
  • Loading branch information
mboben authored Sep 2, 2024
2 parents 8b7f5a2 + 396ed25 commit cd582e0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/chain/p_chain_rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"os"
"time"

"github.com/ava-labs/avalanchego/api"
"github.com/ava-labs/avalanchego/ids"
Expand All @@ -13,6 +14,10 @@ import (
"github.com/ybbus/jsonrpc/v3"
)

const (
RequestTimeout = 10 * time.Second
)

// Copy-paste from
//
// "github.com/ava-labs/avalanchego/vms/platformvm/service"
Expand Down Expand Up @@ -45,7 +50,8 @@ func (c *AvalancheRPCClient) GetRewardUTXOs(id ids.ID) (*GetRewardUTXOsReply, er
Encoding: formatting.Hex,
}
reply := &GetRewardUTXOsReply{}
ctx := context.Background()
ctx, cancelCtx := context.WithTimeout(context.Background(), RequestTimeout)
defer cancelCtx()
response, err := c.client.Call(ctx, "platform.getRewardUTXOs", params)
if err != nil {
return nil, err
Expand Down

0 comments on commit cd582e0

Please sign in to comment.