Skip to content

Commit

Permalink
dev: minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
0xqd committed Jul 8, 2024
1 parent 83f4d0b commit b5ff532
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions crates/rbuilder/src/backtest/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,12 @@ impl HistoricalDataFetcher {
.wrap_err("Failed to fetch onchain tx count")?;

if let Ok(mut nonce_cache) = nonce_cache.write() {
nonce_cache.insert(nonce.address, onchain_nonce);
nonce_cache.entry(address).or_insert(onchain_nonce);
}
res_onchain_nonce = Some(onchain_nonce);
}

let low_nonce = res_onchain_nonce.map_or(true, |onchain_nonce| {
onchain_nonce > nonce.nonce && !nonce.optional
});
if low_nonce {
if res_onchain_nonce.unwrap() > nonce.nonce && !nonce.optional {
trace!(
"Order nonce too low, order: {:?}, nonce: {}, onchain tx count: {}",
id,
Expand Down

0 comments on commit b5ff532

Please sign in to comment.