Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spacebear21 committed Jul 30, 2024
1 parent 4d2ef15 commit c8b703a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion payjoin-cli/src/app/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl App {
})?;
log::trace!("check4");

let mut provisional_payjoin = payjoin.identify_receiver_outputs(|output_script| {
let provisional_payjoin = payjoin.identify_receiver_outputs(|output_script| {
if let Ok(address) = bitcoin::Address::from_script(output_script, network) {
bitcoind
.get_address_info(&address)
Expand Down
5 changes: 4 additions & 1 deletion payjoin-cli/src/app/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,13 @@ impl App {
}
})?;

let mut provisional_payjoin = provisional_payjoin
.try_substitute_receiver_outputs(None::<fn() -> Result<Vec<bitcoin::TxOut>, Error>>)?;

_ = try_contributing_inputs(&mut provisional_payjoin.inner, &bitcoind)
.map_err(|e| log::warn!("Failed to contribute inputs: {}", e));

let payjoin_proposal = provisional_payjoin.finalize_proposal(
let payjoin_proposal = provisional_payjoin.provisional_proposal().finalize_proposal(
|psbt: &Psbt| {
bitcoind
.wallet_process_psbt(&psbt.to_string(), None, None, Some(false))
Expand Down
2 changes: 1 addition & 1 deletion payjoin/src/receive/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ impl WantsOutputs {
}

pub struct WantsInputs {
inner: super::WantsInputs,
pub inner: super::WantsInputs,
context: SessionContext,
}

Expand Down
13 changes: 6 additions & 7 deletions payjoin/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,13 +757,12 @@ mod integration {
.expect("Receiver should have at least one output");

let mut payjoin = payjoin
.try_substitute_receiver_output(|| {
Ok(receiver
.get_new_address(None, None)
.unwrap()
.assume_checked()
.script_pubkey())
})
// TODO:
// a- `None` approach is a pita because type inference doesn't work
// b- hard to substitute outputs when output value from payjoin_psbt is not accessible
.try_substitute_receiver_outputs(
None::<fn() -> Result<Vec<bitcoin::TxOut>, payjoin::Error>>,
)
.expect("Could not substitute outputs");

// Select receiver payjoin inputs. TODO Lock them.
Expand Down

0 comments on commit c8b703a

Please sign in to comment.