Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko-von-Leipzig committed Oct 22, 2024
1 parent 92aa16b commit a884d23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions crates/block-producer/src/domain/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ impl AuthenticatedTransaction {
}
}

/// Overrides the authentication height with the given value.
pub fn with_authentication_height(mut self, height: u32) -> Self {
self.authentication_height = BlockNumber::new(height);
self
}

/// Overrides the store state with the given value.
pub fn with_store_state(mut self, state: Digest) -> Self {
self.store_account_state = Some(state);
Expand Down
6 changes: 4 additions & 2 deletions crates/block-producer/src/mempool/inflight_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,11 @@ mod tests {
}
committed.commit_block(&txs[..i]);

let mut inserted = InflightState::new(BlockNumber::default(), 0);
let mut inserted = InflightState::new(BlockNumber::new(1), 0);
for (idx, tx) in txs.iter().skip(i).enumerate() {
inserted.add_transaction(tx).unwrap_or_else(|err| {
// We need to adjust the height since we are effectively at block "1" now.
let tx = tx.clone().with_authentication_height(1);
inserted.add_transaction(&tx).unwrap_or_else(|err| {
panic!("Inserting tx #{idx} in iteration {i} should succeed: {err}")
});
}
Expand Down

0 comments on commit a884d23

Please sign in to comment.