mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +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 {
|
||||
select {
|
||||
case <-receiptCtx.Done():
|
||||
// Upstream cancellation -> bubble it; otherwise emit the timeout error
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 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 {
|
||||
return nil, err
|
||||
}
|
||||
// Fallback: return the derived context's error.
|
||||
return nil, receiptCtx.Err()
|
||||
|
||||
case err, ok := <-subErrCh:
|
||||
if !ok || err == nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue