mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
check for DeadlineExceeded
This commit is contained in:
parent
1d662b50a6
commit
3ab8ec880b
1 changed files with 10 additions and 5 deletions
|
|
@ -1694,14 +1694,19 @@ func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hex
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-receiptCtx.Done():
|
case <-receiptCtx.Done():
|
||||||
// Upstream cancellation -> bubble it; otherwise emit the timeout error
|
// If server-side wait window elapsed, return the structured timeout.
|
||||||
|
if errors.Is(receiptCtx.Err(), context.DeadlineExceeded) {
|
||||||
|
return nil, &txSyncTimeoutError{
|
||||||
|
msg: fmt.Sprintf("The transaction was added to the transaction pool but wasn't processed in %v.", timeout),
|
||||||
|
hash: hash,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Otherwise, bubble the caller's context error (canceled or deadline).
|
||||||
if err := ctx.Err(); err != nil {
|
if err := ctx.Err(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, &txSyncTimeoutError{
|
// Fallback: return the derived context's error.
|
||||||
msg: fmt.Sprintf("The transaction was added to the transaction pool but wasn't processed in %v.", timeout),
|
return nil, receiptCtx.Err()
|
||||||
hash: hash,
|
|
||||||
}
|
|
||||||
|
|
||||||
case err, ok := <-subErrCh:
|
case err, ok := <-subErrCh:
|
||||||
if !ok || err == nil {
|
if !ok || err == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue