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

feat(pkg): add default timeout for GetStorageRoot #347

Merged
merged 3 commits into from
Aug 3, 2023
Merged
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: 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