From: Matt Corallo Date: Mon, 18 Sep 2023 05:33:26 +0000 (+0000) Subject: Avoid using `hex_str` for payment hashes which now impl Display X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=44b7ad33748d85d885e2876d5afc255791523d3f;p=ldk-sample Avoid using `hex_str` for payment hashes which now impl Display --- diff --git a/src/cli.rs b/src/cli.rs index 121aa98..9cb0f17 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -559,7 +559,7 @@ fn list_payments(inbound_payments: &PaymentInfoStorage, outbound_payments: &Paym println!(""); println!("\t{{"); println!("\t\tamount_millisatoshis: {},", payment_info.amt_msat); - println!("\t\tpayment_hash: {},", hex_utils::hex_str(&payment_hash.0)); + println!("\t\tpayment_hash: {},", payment_hash); println!("\t\thtlc_direction: inbound,"); println!( "\t\thtlc_status: {},", @@ -577,7 +577,7 @@ fn list_payments(inbound_payments: &PaymentInfoStorage, outbound_payments: &Paym println!(""); println!("\t{{"); println!("\t\tamount_millisatoshis: {},", payment_info.amt_msat); - println!("\t\tpayment_hash: {},", hex_utils::hex_str(&payment_hash.0)); + println!("\t\tpayment_hash: {},", payment_hash); println!("\t\thtlc_direction: outbound,"); println!( "\t\thtlc_status: {},", diff --git a/src/main.rs b/src/main.rs index 69f0981..ffe0e69 100644 --- a/src/main.rs +++ b/src/main.rs @@ -218,8 +218,7 @@ async fn handle_ldk_events( } => { println!( "\nEVENT: received payment from payment hash {} of {} millisatoshis", - hex_utils::hex_str(&payment_hash.0), - amount_msat, + payment_hash, amount_msat, ); print!("> "); io::stdout().flush().unwrap(); @@ -239,8 +238,7 @@ async fn handle_ldk_events( } => { println!( "\nEVENT: claimed payment from payment hash {} of {} millisatoshis", - hex_utils::hex_str(&payment_hash.0), - amount_msat, + payment_hash, amount_msat, ); print!("> "); io::stdout().flush().unwrap(); @@ -277,15 +275,15 @@ async fn handle_ldk_events( payment.status = HTLCStatus::Succeeded; println!( "\nEVENT: successfully sent payment of {} millisatoshis{} from \ - payment hash {:?} with preimage {:?}", + 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) + payment_hash, + payment_preimage ); print!("> "); io::stdout().flush().unwrap(); @@ -328,8 +326,8 @@ async fn handle_ldk_events( Event::ProbeFailed { .. } => {} Event::PaymentFailed { payment_hash, reason, .. } => { print!( - "\nEVENT: Failed to send payment to payment hash {:?}: {:?}", - hex_utils::hex_str(&payment_hash.0), + "\nEVENT: Failed to send payment to payment hash {}: {:?}", + payment_hash, if let Some(r) = reason { r } else { PaymentFailureReason::RetriesExhausted } ); print!("> ");