Skip to content

Commit

Permalink
Send Payjoin with fee_rate parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGould committed Jul 12, 2023
1 parent de8d8b3 commit e7188b9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bitcoin/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e7188b9

Please sign in to comment.