@@ -107,13 +107,14 @@ use alloc::collections::{btree_map, BTreeMap};
107
107
use crate::io;
108
108
use crate::prelude::*;
109
109
use core::{cmp, mem};
110
+ use core::borrow::Borrow;
110
111
use core::cell::RefCell;
111
112
use crate::io::Read;
112
113
use crate::sync::{Arc, Mutex, RwLock, RwLockReadGuard, FairRwLock, LockTestExt, LockHeldState};
113
114
use core::sync::atomic::{AtomicUsize, AtomicBool, Ordering};
114
115
use core::time::Duration;
115
116
use core::ops::Deref;
116
-
117
+ use bitcoin::hex::impl_fmt_traits;
117
118
// Re-export this for use in the public API.
118
119
pub use crate::ln::outbound_payment::{Bolt12PaymentError, PaymentSendFailure, ProbeSendFailure, Retry, RetryableSendFailure, RecipientOnionFields};
119
120
use crate::ln::script::ShutdownScript;
@@ -468,7 +469,7 @@ impl Verification for PaymentHash {
468
469
/// a payment and ensure idempotency in LDK.
469
470
///
470
471
/// This is not exported to bindings users as we just use [u8; 32] directly
471
- #[derive(Hash, Copy, Clone, PartialEq, Eq, Debug )]
472
+ #[derive(Hash, Copy, Clone, PartialEq, Eq)]
472
473
pub struct PaymentId(pub [u8; Self::LENGTH]);
473
474
474
475
impl PaymentId {
@@ -528,6 +529,18 @@ impl PaymentId {
528
529
}
529
530
}
530
531
532
+ impl Borrow<[u8]> for PaymentId {
533
+ fn borrow(&self) -> &[u8] {
534
+ &self.0[..]
535
+ }
536
+ }
537
+
538
+ impl_fmt_traits! {
539
+ impl fmt_traits for PaymentId {
540
+ const LENGTH: usize = 32;
541
+ }
542
+ }
543
+
531
544
impl Writeable for PaymentId {
532
545
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
533
546
self.0.write(w)
@@ -541,12 +554,6 @@ impl Readable for PaymentId {
541
554
}
542
555
}
543
556
544
- impl core::fmt::Display for PaymentId {
545
- fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
546
- crate::util::logger::DebugBytes(&self.0).fmt(f)
547
- }
548
- }
549
-
550
557
/// An identifier used to uniquely identify an intercepted HTLC to LDK.
551
558
///
552
559
/// This is not exported to bindings users as we just use [u8; 32] directly
0 commit comments