Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
grumbach committed Jul 5, 2024
1 parent baff6d3 commit bd81c37
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions sn_node/tests/double_spend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use itertools::Itertools;
use sn_logging::LogBuilder;
use sn_networking::NetworkError;
use sn_transfers::{
get_genesis_sk, rng, DerivationIndex, HotWallet, NanoTokens, OfflineTransfer, SpendReason, WalletError, GENESIS_CASHNOTE
get_genesis_sk, rng, DerivationIndex, HotWallet, NanoTokens, OfflineTransfer, SpendReason,
WalletError, GENESIS_CASHNOTE,
};
use std::time::Duration;
use tracing::*;
Expand Down Expand Up @@ -518,13 +519,20 @@ async fn spamming_double_spends_should_not_shadow_live_branch() -> Result<()> {
});

// the original A should still be present as one of the double spends
let res = client.get_spend_from_network(original_a_spend.address()).await;
assert_matches!(res, Err(sn_client::Error::Network(NetworkError::DoubleSpendAttempt(_))));
let res = client
.get_spend_from_network(original_a_spend.address())
.await;
assert_matches!(
res,
Err(sn_client::Error::Network(NetworkError::DoubleSpendAttempt(
_
)))
);
if let Err(sn_client::Error::Network(NetworkError::DoubleSpendAttempt(spends))) = res {
assert!(spends.iter().contains(original_a_spend))
}

// Try to double spend A -> 10 different random keys
// Try to double spend A -> n different random keys
for _ in 0..20 {
println!("Spamming double spends on A");
let wallet_dir_y = TempDir::new()?;
Expand Down Expand Up @@ -554,8 +562,15 @@ async fn spamming_double_spends_should_not_shadow_live_branch() -> Result<()> {
});

// the original A should still be present as one of the double spends
let res = client.get_spend_from_network(original_a_spend.address()).await;
assert_matches!(res, Err(sn_client::Error::Network(NetworkError::DoubleSpendAttempt(_))));
let res = client
.get_spend_from_network(original_a_spend.address())
.await;
assert_matches!(
res,
Err(sn_client::Error::Network(NetworkError::DoubleSpendAttempt(
_
)))
);
if let Err(sn_client::Error::Network(NetworkError::DoubleSpendAttempt(spends))) = res {
assert!(spends.iter().contains(original_a_spend))
}
Expand Down

0 comments on commit bd81c37

Please sign in to comment.