From e7188b9844ee017228ae4c9566383cf19f6bafef Mon Sep 17 00:00:00 2001 From: DanGould Date: Wed, 12 Jul 2023 14:53:54 -0400 Subject: [PATCH] Send Payjoin with fee_rate parameter --- src/bitcoin/payment.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bitcoin/payment.rs b/src/bitcoin/payment.rs index 2523d2e1..c5094b5e 100644 --- a/src/bitcoin/payment.rs +++ b/src/bitcoin/payment.rs @@ -64,8 +64,14 @@ pub async fn create_payjoin( let original_psbt = sign_original_psbt(wallet, psbt).await?; info!("Original PSBT successfully signed"); - // TODO use fee_rate - let pj_params = payjoin::send::Configuration::non_incentivizing(); + let pj_params = match fee_rate { + Some(fee_rate) => { + payjoin::send::Configuration::with_fee_contribution(bitcoin::Amount::ZERO, 0) + .min_fee_rate_sat_per_vb(fee_rate.as_sat_per_vb()) + } + None => payjoin::send::Configuration::non_incentivizing(), + }; + let (req, ctx) = pj_uri.create_pj_request(original_psbt.clone(), pj_params)?; info!("Built PayJoin request"); let response = reqwest::Client::new()