check for DeadlineExceeded

This commit is contained in:
aodhgan 2025-10-13 12:57:23 -07:00
parent 1d662b50a6
commit 3ab8ec880b

View file

@ -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 {