fix: forward transaction non-blocking context canceled (#1234)

This commit is contained in:
Morty 2025-08-08 14:28:35 +08:00 committed by GitHub
parent 2ebcd8a20f
commit 8bee78a76c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 3 deletions

View file

@ -290,9 +290,12 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction)
// If the transaction pool is enabled, we send the transaction to the sequencer RPC asynchronously as this is
// additional to the public mempool.
go func() {
// create a new context with a timeout to prevent the original context from being cancelled
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
err := b.sendToSequencer(ctx, signedTx)
if err != nil {
log.Warn("failed to forward tx to sequencer", "tx", signedTx.Hash(), "err", err)
log.Debug("failed to forward tx to sequencer asynchronously", "tx", signedTx.Hash(), "err", err)
}
}()
}

View file

@ -308,7 +308,7 @@ func New(stack *node.Node, config *ethconfig.Config, l1Client l1.Client) (*Ether
// Some of the extraData is used with Clique consensus (before EuclidV2). After EuclidV2 we use SystemContract consensus where this is overridden when creating a block.
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData))
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, config.GossipTxReceivingDisabled, eth, nil}
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, config.GossipTxBroadcastDisabled, eth, nil}
if eth.APIBackend.allowUnprotectedTxs {
log.Info("Unprotected transactions allowed")
}

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 9 // Minor version component of the current release
VersionPatch = 1 // Patch version component of the current release
VersionPatch = 2 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)