Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mojoX911 committed Jan 21, 2025
1 parent 47d0204 commit 9452d72
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 18 deletions.
4 changes: 3 additions & 1 deletion tests/abort1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ fn test_stop_taker_after_setup() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
8 changes: 5 additions & 3 deletions tests/abort2_case1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ fn test_abort_case_2_move_on_with_other_makers() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down Expand Up @@ -198,7 +200,7 @@ fn test_abort_case_2_move_on_with_other_makers() {
let taker_wallet_mut = taker.get_wallet_mut();

let swap_coins = taker_wallet_mut
.list_swap_coin_utxo_spend_info(None)
.list_incoming_swap_coin_utxo_spend_info(None)
.unwrap();

let tx = taker_wallet_mut
Expand All @@ -221,7 +223,7 @@ fn test_abort_case_2_move_on_with_other_makers() {

taker_wallet_mut.sync().unwrap();

let swap_coin_bal = taker_wallet_mut.balance_swap_coins(None).unwrap();
let swap_coin_bal = taker_wallet_mut.balance_incoming_swap_coins(None).unwrap();
let descriptor_bal = taker_wallet_mut.balance_descriptor_utxo(None).unwrap();

assert_eq!(swap_coin_bal, Amount::ZERO);
Expand Down
4 changes: 3 additions & 1 deletion tests/abort2_case2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ fn test_abort_case_2_recover_if_no_makers_found() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
4 changes: 3 additions & 1 deletion tests/abort2_case3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ fn maker_drops_after_sending_senders_sigs() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
4 changes: 3 additions & 1 deletion tests/abort3_case1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ fn abort3_case1_close_at_contract_sigs_for_recvr_and_sender() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
4 changes: 3 additions & 1 deletion tests/abort3_case2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ fn abort3_case2_close_at_contract_sigs_for_recvr() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
4 changes: 3 additions & 1 deletion tests/abort3_case3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ fn abort3_case3_close_at_hash_preimage_handover() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
4 changes: 3 additions & 1 deletion tests/malice1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ fn malice1_taker_broadcast_contract_prematurely() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
4 changes: 3 additions & 1 deletion tests/malice2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ fn malice2_maker_broadcast_contract_prematurely() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down
8 changes: 5 additions & 3 deletions tests/standard_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ fn test_standard_coinswap() {

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down Expand Up @@ -158,7 +160,7 @@ fn test_standard_coinswap() {

let taker_wallet_mut = taker.get_wallet_mut();
let swap_coins = taker_wallet_mut
.list_swap_coin_utxo_spend_info(None)
.list_incoming_swap_coin_utxo_spend_info(None)
.unwrap();

let tx = taker_wallet_mut
Expand All @@ -179,7 +181,7 @@ fn test_standard_coinswap() {
bitcoind.client.send_raw_transaction(&tx).unwrap();
generate_blocks(bitcoind, 1);

let swap_coin_bal = taker_wallet_mut.balance_swap_coins(None).unwrap();
let swap_coin_bal = taker_wallet_mut.balance_incoming_swap_coins(None).unwrap();
let descriptor_bal = taker_wallet_mut.balance_descriptor_utxo(None).unwrap();

assert_eq!(swap_coin_bal, Amount::ZERO);
Expand Down
16 changes: 12 additions & 4 deletions tests/test_framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ pub fn fund_and_verify_taker(

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand Down Expand Up @@ -255,7 +257,9 @@ pub fn fund_and_verify_maker(

let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();

let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();

let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

Expand All @@ -281,7 +285,9 @@ pub fn verify_swap_results(
let all_utxos = wallet.get_all_utxo().unwrap();
let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();
let seed_balance = wallet.balance_descriptor_utxo(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();
let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

let spendable_balance = seed_balance + swapcoin_balance;
Expand Down Expand Up @@ -324,7 +330,9 @@ pub fn verify_swap_results(
let all_utxos = wallet.get_all_utxo().unwrap();
let fidelity_balance = wallet.balance_fidelity_bonds(Some(&all_utxos)).unwrap();
let seed_balance = wallet.balance_descriptor_utxo(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet.balance_swap_coins(Some(&all_utxos)).unwrap();
let swapcoin_balance = wallet
.balance_incoming_swap_coins(Some(&all_utxos))
.unwrap();
let live_contract_balance = wallet.balance_live_contract(Some(&all_utxos)).unwrap();

let spendable_balance = seed_balance + swapcoin_balance;
Expand Down

0 comments on commit 9452d72

Please sign in to comment.