From 6803c8bf0f1116d025feb1575d4057c5648c09ae Mon Sep 17 00:00:00 2001 From: DanGould Date: Mon, 7 Oct 2024 14:16:24 -0400 Subject: [PATCH] Explicit try_preserving_privacy err handleing --- payjoin-cli/src/app/v1.rs | 4 +++- payjoin-cli/src/app/v2.rs | 4 +++- payjoin/tests/integration.rs | 9 ++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/payjoin-cli/src/app/v1.rs b/payjoin-cli/src/app/v1.rs index c7a20ca1..ca8093b7 100644 --- a/payjoin-cli/src/app/v1.rs +++ b/payjoin-cli/src/app/v1.rs @@ -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) diff --git a/payjoin-cli/src/app/v2.rs b/payjoin-cli/src/app/v2.rs index c2a20be9..0969769b 100644 --- a/payjoin-cli/src/app/v2.rs +++ b/payjoin-cli/src/app/v2.rs @@ -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) diff --git a/payjoin/tests/integration.rs b/payjoin/tests/integration.rs index 5bef15a3..dcc53ec5 100644 --- a/payjoin/tests/integration.rs +++ b/payjoin/tests/integration.rs @@ -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) @@ -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)