mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +00:00
internal/ethapi: cap default tx sync timeout at RPC max
SendRawTransactionSync capped an explicitly requested timeout but not the configured default. Clamp defaultTimeout to the max so a misconfigured default cannot wait longer than RPCTxSyncMaxTimeout.
This commit is contained in:
parent
abfb2de574
commit
a34dbd8435
1 changed files with 3 additions and 0 deletions
|
|
@ -1790,6 +1790,9 @@ func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hex
|
||||||
defaultTimeout = api.b.RPCTxSyncDefaultTimeout()
|
defaultTimeout = api.b.RPCTxSyncDefaultTimeout()
|
||||||
timeout = defaultTimeout
|
timeout = defaultTimeout
|
||||||
)
|
)
|
||||||
|
if timeout > maxTimeout {
|
||||||
|
timeout = maxTimeout
|
||||||
|
}
|
||||||
if timeoutMs != nil && *timeoutMs > 0 {
|
if timeoutMs != nil && *timeoutMs > 0 {
|
||||||
req := time.Duration(*timeoutMs) * time.Millisecond
|
req := time.Duration(*timeoutMs) * time.Millisecond
|
||||||
if req > maxTimeout {
|
if req > maxTimeout {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue