Skip to content

Commit 8bee78a

Browse files
authored
fix: forward transaction non-blocking context canceled (#1234)
1 parent 2ebcd8a commit 8bee78a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

eth/api_backend.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,12 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction)
290290
// If the transaction pool is enabled, we send the transaction to the sequencer RPC asynchronously as this is
291291
// additional to the public mempool.
292292
go func() {
293+
// create a new context with a timeout to prevent the original context from being cancelled
294+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
295+
defer cancel()
293296
err := b.sendToSequencer(ctx, signedTx)
294297
if err != nil {
295-
log.Warn("failed to forward tx to sequencer", "tx", signedTx.Hash(), "err", err)
298+
log.Debug("failed to forward tx to sequencer asynchronously", "tx", signedTx.Hash(), "err", err)
296299
}
297300
}()
298301
}

eth/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func New(stack *node.Node, config *ethconfig.Config, l1Client l1.Client) (*Ether
308308
// 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.
309309
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData))
310310

311-
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, config.GossipTxReceivingDisabled, eth, nil}
311+
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, config.GossipTxBroadcastDisabled, eth, nil}
312312
if eth.APIBackend.allowUnprotectedTxs {
313313
log.Info("Unprotected transactions allowed")
314314
}

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 9 // Minor version component of the current release
27-
VersionPatch = 1 // Patch version component of the current release
27+
VersionPatch = 2 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)