Skip to content

Commit

Permalink
fix: use next available nonce for tx
Browse files Browse the repository at this point in the history
Closes #39
  • Loading branch information
onbjerg committed Oct 20, 2024
1 parent 2f82401 commit a8ba89e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,16 @@ where
let _permit = self.inner.permit.lock().await;

// set nonce
let tx_count = EthState::transaction_count(
let next_nonce = EthState::next_available_nonce(
&self.inner.eth_api,
NetworkWallet::<Ethereum>::default_signer_address(&self.inner.wallet),
Some(BlockId::pending()),
)
.await
.map_err(|err| {
self.inner.metrics.invalid_send_transaction_calls.increment(1);
err.into()
})?;
request.nonce = Some(tx_count.to());
request.nonce = Some(next_nonce.to());

// set chain id
request.chain_id = Some(self.chain_id());
Expand Down

0 comments on commit a8ba89e

Please sign in to comment.