From 271f227909eb61c50379467a20f5e85475ddd041 Mon Sep 17 00:00:00 2001 From: Dimitris Date: Fri, 6 Dec 2024 16:55:21 +0200 Subject: [PATCH] Add fixes --- .../evm/txm/clientwrappers/dual_broadcast_client.go | 4 ++-- core/chains/evm/txm/storage/inmemory_store.go | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/core/chains/evm/txm/clientwrappers/dual_broadcast_client.go b/core/chains/evm/txm/clientwrappers/dual_broadcast_client.go index 0bbd2530765..77111c2d48c 100644 --- a/core/chains/evm/txm/clientwrappers/dual_broadcast_client.go +++ b/core/chains/evm/txm/clientwrappers/dual_broadcast_client.go @@ -42,7 +42,7 @@ func (d *DualBroadcastClient) NonceAt(ctx context.Context, address common.Addres } func (d *DualBroadcastClient) PendingNonceAt(ctx context.Context, address common.Address) (uint64, error) { - body := []byte(fmt.Sprintf(`{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["%s","pending"]}`, address.String())) + body := []byte(fmt.Sprintf(`{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["%s","pending"], "id":1}`, address.String())) response, err := d.signAndPostMessage(ctx, address, body, "") if err != nil { return 0, err @@ -70,7 +70,7 @@ func (d *DualBroadcastClient) SendTransaction(ctx context.Context, tx *types.Tra if meta.DualBroadcastParams != nil { params = *meta.DualBroadcastParams } - body := []byte(fmt.Sprintf(`{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["%s"]}`, hexutil.Encode(data))) + body := []byte(fmt.Sprintf(`{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["%s"], "id":1}`, hexutil.Encode(data))) if _, err = d.signAndPostMessage(ctx, tx.FromAddress, body, params); err != nil { return err } diff --git a/core/chains/evm/txm/storage/inmemory_store.go b/core/chains/evm/txm/storage/inmemory_store.go index 013f7844a44..49bb54e98af 100644 --- a/core/chains/evm/txm/storage/inmemory_store.go +++ b/core/chains/evm/txm/storage/inmemory_store.go @@ -114,8 +114,8 @@ func (m *InMemoryStore) CreateEmptyUnconfirmedTransaction(nonce uint64, gasLimit return nil, fmt.Errorf("an unconfirmed tx with the same nonce already exists: %v", m.UnconfirmedTransactions[nonce]) } - if _, exists := m.Transactions[nonce]; exists { - return nil, fmt.Errorf("a tx with the same nonce already exists: %v", m.Transactions[nonce]) + if _, exists := m.ConfirmedTransactions[nonce]; exists { + return nil, fmt.Errorf("a confirmed tx with the same nonce already exists: %v", m.ConfirmedTransactions[nonce]) } m.UnconfirmedTransactions[nonce] = emptyTx @@ -264,10 +264,6 @@ func (m *InMemoryStore) UpdateUnstartedTransactionWithNonce(nonce uint64) (*type return nil, fmt.Errorf("an unconfirmed tx with the same nonce already exists: %v", m.UnconfirmedTransactions[nonce]) } - if _, exists := m.Transactions[nonce]; exists { - return nil, fmt.Errorf("a tx with the same nonce already exists: %v", m.Transactions[nonce]) - } - tx := m.UnstartedTransactions[0] tx.Nonce = &nonce tx.State = types.TxUnconfirmed