eth: return err if local tracker is not configured

This commit is contained in:
Gary Rong 2025-02-26 12:45:41 +08:00
parent c748bf6201
commit df06cba97b

View file

@ -272,7 +272,8 @@ func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscri
} }
func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
if locals := b.eth.localTxTracker; locals != nil { locals := b.eth.localTxTracker
if locals != nil {
if err := locals.Track(signedTx); err != nil { if err := locals.Track(signedTx); err != nil {
return err return err
} }
@ -280,7 +281,10 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction)
// No error will be returned to user if the transaction fails stateful // No error will be returned to user if the transaction fails stateful
// validation (e.g., no available slot), as the locally submitted transactions // validation (e.g., no available slot), as the locally submitted transactions
// may be resubmitted later via the local tracker. // may be resubmitted later via the local tracker.
b.eth.txPool.Add([]*types.Transaction{signedTx}, false) err := b.eth.txPool.Add([]*types.Transaction{signedTx}, false)[0]
if err != nil && locals == nil {
return err
}
return nil return nil
} }