handle unwell sub on success

This commit is contained in:
aodhgan 2025-10-13 13:16:50 -07:00
parent 409eea4063
commit eed426c36f

View file

@ -55,6 +55,7 @@ import (
const estimateGasErrorRatio = 0.015 const estimateGasErrorRatio = 0.015
var errBlobTxNotSupported = errors.New("signing blob transactions not supported") var errBlobTxNotSupported = errors.New("signing blob transactions not supported")
var errSubClosed = errors.New("chain subscription closed")
// EthereumAPI provides an API to access Ethereum related information. // EthereumAPI provides an API to access Ethereum related information.
type EthereumAPI struct { type EthereumAPI struct {
@ -1710,11 +1711,14 @@ func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hex
case err, ok := <-subErrCh: case err, ok := <-subErrCh:
if !ok { if !ok {
return nil, errors.New("chain subscription closed") return nil, errSubClosed
} }
return nil, err return nil, err
case ev := <-ch: case ev, ok := <-ch:
if !ok {
return nil, errSubClosed
}
rs := ev.Receipts rs := ev.Receipts
txs := ev.Transactions txs := ev.Transactions
if len(rs) == 0 || len(rs) != len(txs) { if len(rs) == 0 || len(rs) != len(txs) {