use context deadline for timeout in eth_call
This commit is contained in:
parent
1552c6136b
commit
7c0492a204
@ -879,7 +879,12 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr
|
|||||||
if overrides != nil {
|
if overrides != nil {
|
||||||
accounts = *overrides
|
accounts = *overrides
|
||||||
}
|
}
|
||||||
result, _, _, err := DoCall(ctx, s.b, args, blockNrOrHash, accounts, vm.Config{}, 5*time.Second, s.b.RPCGasCap())
|
timeout := 5 * time.Second
|
||||||
|
d, ok := ctx.Deadline()
|
||||||
|
if ok {
|
||||||
|
timeout = d.Sub(time.Now())
|
||||||
|
}
|
||||||
|
result, _, _, err := DoCall(ctx, s.b, args, blockNrOrHash, accounts, vm.Config{}, timeout, s.b.RPCGasCap())
|
||||||
return (hexutil.Bytes)(result), err
|
return (hexutil.Bytes)(result), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user