Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(pkg): add default timeout for GetStorageRoot (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Aug 3, 2023
1 parent c6454af commit 9a4dee0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,17 @@ func (c *Client) GetStorageRoot(
contract common.Address,
height *big.Int,
) (common.Hash, error) {
var (
ctxWithTimeout = ctx
cancel context.CancelFunc
)
if _, ok := ctx.Deadline(); !ok {
ctxWithTimeout, cancel = context.WithTimeout(ctx, defaultTimeout)
defer cancel()
}

proof, err := gethclient.GetProof(
ctx,
ctxWithTimeout,
contract,
[]string{"0x0000000000000000000000000000000000000000000000000000000000000000"},
height,
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package version

// Version info.
var (
Version = "0.13.0"
Version = "0.14.0"
Meta = "dev"
)

Expand Down

0 comments on commit 9a4dee0

Please sign in to comment.