Skip to content

Commit

Permalink
chore: nit
Browse files Browse the repository at this point in the history
  • Loading branch information
matteojug committed Oct 1, 2024
1 parent a93cab4 commit 4d78355
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions signer/src/testing/transaction_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,16 @@ where
test_data.remove(original_test_data);
self.write_test_data(&test_data).await;

let chain_tip = self
.context
.get_storage()
let storage = self.context.get_storage();

let chain_tip = storage
.get_bitcoin_canonical_chain_tip()
.await
.expect("storage failure")
.expect("missing block");
assert_eq!(chain_tip, block_ref.block_hash);

let signer_utxo = self
.context
.get_storage()
let signer_utxo = storage
.get_signer_utxo(&chain_tip, &aggregate_key, self.context_window as u16)
.await
.unwrap()
Expand Down Expand Up @@ -382,6 +380,8 @@ where
test_data.remove(original_test_data);
self.write_test_data(&test_data).await;

let storage = self.context.get_storage();

for (chain_tip, tx, amt) in [
(&block_a1, &tx_a1, 0xA1),
(&block_a2, &tx_a2, 0xA2),
Expand All @@ -397,9 +397,7 @@ where
amount: amt,
public_key: bitcoin::XOnlyPublicKey::from(aggregate_key),
};
let signer_utxo = self
.context
.get_storage()
let signer_utxo = storage
.get_signer_utxo(
&chain_tip.block_hash,
&aggregate_key,
Expand All @@ -412,16 +410,12 @@ where
}

// Check context window
assert!(self
.context
.get_storage()
assert!(storage
.get_signer_utxo(&block_c2.block_hash, &aggregate_key, 1)
.await
.unwrap()
.is_none());
assert!(self
.context
.get_storage()
assert!(storage
.get_signer_utxo(&block_c2.block_hash, &aggregate_key, 2)
.await
.unwrap()
Expand Down Expand Up @@ -500,18 +494,16 @@ where
test_data.remove(original_test_data);
self.write_test_data(&test_data).await;

let chain_tip = self
.context
.get_storage()
let storage = self.context.get_storage();

let chain_tip = storage
.get_bitcoin_canonical_chain_tip()
.await
.expect("storage failure")
.expect("missing block");
assert_eq!(chain_tip, block_ref.block_hash);

let signer_utxo = self
.context
.get_storage()
let signer_utxo = storage
.get_signer_utxo(&chain_tip, &aggregate_key, self.context_window as u16)
.await
.unwrap()
Expand Down

0 comments on commit 4d78355

Please sign in to comment.