Skip to content

Commit

Permalink
More comments
Browse files Browse the repository at this point in the history
  • Loading branch information
m30m committed Jul 18, 2024
1 parent c0ed513 commit e9bbb61
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/fortuna/src/chain/nonce_manager.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This is a copy of the NonceManagerMiddleware from ethers-rs, with an additional reset method.
// Copied from: https://github.com/gakonst/ethers-rs/blob/34ed9e372e66235aed7074bc3f5c14922b139242/ethers-middleware/src/nonce_manager.rs

use {
axum::async_trait,
Expand Down Expand Up @@ -82,6 +83,11 @@ where
Ok(nonce)
} // guard dropped here

/// Resets the initialized flag so the next usage of the manager will reinitialize the nonce
/// based on the chain state.
/// This is useful when the RPC does not return an error if the transaction is submitted with
/// an incorrect nonce.
/// This is the only new method compared to the original NonceManagerMiddleware.
pub fn reset(&self) {
self.initialized.store(false, Ordering::SeqCst);
}
Expand Down

0 comments on commit e9bbb61

Please sign in to comment.