Skip to content

Commit

Permalink
test(electrum): added scan and reorg tests
Browse files Browse the repository at this point in the history
Added scan and reorg tests to check electrum functionality using
`TestEnv`.
  • Loading branch information
LagginTimes committed Jan 22, 2024
1 parent 12e4e20 commit 421be34
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/electrum/tests/test_electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ fn tx_can_become_unconfirmed_after_reorg() -> Result<()> {
let missing = relevant_txids.missing_full_txs(recv_graph.graph());
let graph_update = relevant_txids.into_confirmation_time_tx_graph(&client, None, missing)?;
let _ = recv_chain.apply_update(chain_update);
let _ = recv_graph.apply_update(graph_update);
let _ = recv_graph.apply_update(graph_update.clone());

// Retain a snapshot of all anchors before reog process.
let initial_anchors = graph_update.all_anchors();

// Check if initial balance is correct.
assert_eq!(
Expand All @@ -214,6 +217,11 @@ fn tx_can_become_unconfirmed_after_reorg() -> Result<()> {
let graph_update =
relevant_txids.into_confirmation_time_tx_graph(&client, None, missing)?;
let _ = recv_chain.apply_update(chain_update);

// Check to see if a new anchor is added during current reorg.
if !initial_anchors.is_superset(graph_update.all_anchors()) {
println!("New anchor added at reorg depth {}", depth);
}
let _ = recv_graph.apply_update(graph_update);

assert_eq!(
Expand Down

0 comments on commit 421be34

Please sign in to comment.