Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package eth
import (
"context"
"errors"
"fmt"
"math/big"
"time"

Expand Down Expand Up @@ -277,16 +278,35 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction)

// Forward to remote sequencer RPC
if b.eth.sequencerRPCService != nil {
signedTxData, err := signedTx.MarshalBinary()
if err != nil {
// If the transaction pool is disabled, then we need to make sure that we send the transaction to the sequencer RPC synchronously.
if b.disableTxPool {
err = b.sendToSequencer(ctx, signedTx)
if err != nil {
log.Warn("failed to forward tx to sequencer", "tx", signedTx.Hash(), "err", err)
}
return err
}
if err = b.eth.sequencerRPCService.CallContext(ctx, nil, "eth_sendRawTransaction", hexutil.Encode(signedTxData)); err != nil {
log.Warn("failed to forward tx to sequencer", "tx", signedTx.Hash(), "err", err)
if b.disableTxPool {
return err

// 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() {
err := b.sendToSequencer(ctx, signedTx)
if err != nil {
log.Warn("failed to forward tx to sequencer", "tx", signedTx.Hash(), "err", err)
}
}
}()
}

return nil
}

func (b *EthAPIBackend) sendToSequencer(ctx context.Context, signedTx *types.Transaction) error {
signedTxData, err := signedTx.MarshalBinary()
if err != nil {
return fmt.Errorf("failed to marshal signed tx: %w", err)
}
if err = b.eth.sequencerRPCService.CallContext(ctx, nil, "eth_sendRawTransaction", hexutil.Encode(signedTxData)); err != nil {
return fmt.Errorf("eth_sendRawTransaction to sequencer RPC failed: %w", err)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 8 // Minor version component of the current release
VersionPatch = 75 // Patch version component of the current release
VersionPatch = 76 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
Loading