Skip to content

Commit

Permalink
Explicit try_preserving_privacy err handleing
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGould committed Oct 7, 2024
1 parent 5866dc7 commit 6803c8b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion payjoin-cli/src/app/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ fn try_contributing_inputs(
.map(|i| (i.amount, OutPoint { txid: i.txid, vout: i.vout }))
.collect();

let selected_outpoint = payjoin.try_preserving_privacy(candidate_inputs).expect("gg");
let selected_outpoint = payjoin
.try_preserving_privacy(candidate_inputs)
.map_err(|e| anyhow!("Failed to make privacy preserving selection: {}", e))?;
let selected_utxo = available_inputs
.iter()
.find(|i| i.txid == selected_outpoint.txid && i.vout == selected_outpoint.vout)
Expand Down
4 changes: 3 additions & 1 deletion payjoin-cli/src/app/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ fn try_contributing_inputs(
.map(|i| (i.amount, OutPoint { txid: i.txid, vout: i.vout }))
.collect();

let selected_outpoint = payjoin.try_preserving_privacy(candidate_inputs).expect("gg");
let selected_outpoint = payjoin
.try_preserving_privacy(candidate_inputs)
.map_err(|e| anyhow!("Failed to make privacy preserving selection: {}", e))?;
let selected_utxo = available_inputs
.iter()
.find(|i| i.txid == selected_outpoint.txid && i.vout == selected_outpoint.vout)
Expand Down
9 changes: 6 additions & 3 deletions payjoin/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,9 @@ mod integration {
.map(|i| (i.amount, OutPoint { txid: i.txid, vout: i.vout }))
.collect();

let selected_outpoint = payjoin.try_preserving_privacy(candidate_inputs).expect("gg");
let selected_outpoint = payjoin
.try_preserving_privacy(candidate_inputs)
.expect("Failed to make privacy preserving selection");
let selected_utxo = available_inputs
.iter()
.find(|i| i.txid == selected_outpoint.txid && i.vout == selected_outpoint.vout)
Expand Down Expand Up @@ -1091,8 +1093,9 @@ mod integration {
.map(|i| (i.amount, OutPoint { txid: i.txid, vout: i.vout }))
.collect();

let selected_outpoint =
payjoin.try_preserving_privacy(candidate_inputs).expect("gg");
let selected_outpoint = payjoin
.try_preserving_privacy(candidate_inputs)
.expect("Failed to make privacy preserving selection");
let selected_utxo = available_inputs
.iter()
.find(|i| i.txid == selected_outpoint.txid && i.vout == selected_outpoint.vout)
Expand Down

0 comments on commit 6803c8b

Please sign in to comment.