Skip to content

Commit

Permalink
Fix DualBroadcast ID (#15545)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimriou authored Dec 6, 2024
1 parent 4fe146a commit 701712f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions core/chains/evm/txm/clientwrappers/dual_broadcast_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 2 additions & 6 deletions core/chains/evm/txm/storage/inmemory_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 701712f

Please sign in to comment.