eth: do not add failed tx to localTxTracker

This commit is contained in:
Kuwon Sebastian Na 2025-02-18 18:28:34 +09:00 committed by Gary Rong
parent 939a804146
commit c00825fe75

View file

@ -272,10 +272,13 @@ 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 { err := b.eth.txPool.Add([]*types.Transaction{signedTx}, false)[0]
locals.Track(signedTx) if err == nil {
if locals := b.eth.localTxTracker; locals != nil {
locals.Track(signedTx)
}
} }
return b.eth.txPool.Add([]*types.Transaction{signedTx}, false)[0] return err
} }
func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error) { func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error) {