From: Matt Corallo Date: Sun, 19 Dec 2021 21:20:11 +0000 (+0000) Subject: Expose the fee paid on a payment in stdout X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-sample;a=commitdiff_plain;h=ef6255353982dc7b64b167b2e56f35e0ce944b55 Expose the fee paid on a payment in stdout --- diff --git a/src/main.rs b/src/main.rs index 343c2d5..71b2cdc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -195,16 +195,21 @@ async fn handle_ldk_events( } } } - Event::PaymentSent { payment_preimage, payment_hash, .. } => { + Event::PaymentSent { payment_preimage, payment_hash, fee_paid_msat, .. } => { let mut payments = outbound_payments.lock().unwrap(); for (hash, payment) in payments.iter_mut() { if *hash == *payment_hash { payment.preimage = Some(*payment_preimage); payment.status = HTLCStatus::Succeeded; println!( - "\nEVENT: successfully sent payment of {} millisatoshis from \ + "\nEVENT: successfully sent payment of {} millisatoshis{} from \ payment hash {:?} with preimage {:?}", payment.amt_msat, + if let Some(fee) = fee_paid_msat { + format!(" (fee {} msat)", fee) + } else { + "".to_string() + }, hex_utils::hex_str(&payment_hash.0), hex_utils::hex_str(&payment_preimage.0) );