mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
Implement to_lower_hex() Display/Debug for PaymentId.
This commit is contained in:
parent
260322ea72
commit
c75730a55f
1 changed files with 15 additions and 8 deletions
|
@ -107,13 +107,14 @@ use alloc::collections::{btree_map, BTreeMap};
|
||||||
use crate::io;
|
use crate::io;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use core::{cmp, mem};
|
use core::{cmp, mem};
|
||||||
|
use core::borrow::Borrow;
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use crate::io::Read;
|
use crate::io::Read;
|
||||||
use crate::sync::{Arc, Mutex, RwLock, RwLockReadGuard, FairRwLock, LockTestExt, LockHeldState};
|
use crate::sync::{Arc, Mutex, RwLock, RwLockReadGuard, FairRwLock, LockTestExt, LockHeldState};
|
||||||
use core::sync::atomic::{AtomicUsize, AtomicBool, Ordering};
|
use core::sync::atomic::{AtomicUsize, AtomicBool, Ordering};
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
|
use bitcoin::hex::impl_fmt_traits;
|
||||||
// Re-export this for use in the public API.
|
// Re-export this for use in the public API.
|
||||||
pub use crate::ln::outbound_payment::{Bolt12PaymentError, PaymentSendFailure, ProbeSendFailure, Retry, RetryableSendFailure, RecipientOnionFields};
|
pub use crate::ln::outbound_payment::{Bolt12PaymentError, PaymentSendFailure, ProbeSendFailure, Retry, RetryableSendFailure, RecipientOnionFields};
|
||||||
use crate::ln::script::ShutdownScript;
|
use crate::ln::script::ShutdownScript;
|
||||||
|
@ -468,7 +469,7 @@ impl Verification for PaymentHash {
|
||||||
/// a payment and ensure idempotency in LDK.
|
/// a payment and ensure idempotency in LDK.
|
||||||
///
|
///
|
||||||
/// This is not exported to bindings users as we just use [u8; 32] directly
|
/// This is not exported to bindings users as we just use [u8; 32] directly
|
||||||
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Hash, Copy, Clone, PartialEq, Eq)]
|
||||||
pub struct PaymentId(pub [u8; Self::LENGTH]);
|
pub struct PaymentId(pub [u8; Self::LENGTH]);
|
||||||
|
|
||||||
impl PaymentId {
|
impl PaymentId {
|
||||||
|
@ -528,6 +529,18 @@ impl PaymentId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Borrow<[u8]> for PaymentId {
|
||||||
|
fn borrow(&self) -> &[u8] {
|
||||||
|
&self.0[..]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_fmt_traits! {
|
||||||
|
impl fmt_traits for PaymentId {
|
||||||
|
const LENGTH: usize = 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Writeable for PaymentId {
|
impl Writeable for PaymentId {
|
||||||
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
|
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
|
||||||
self.0.write(w)
|
self.0.write(w)
|
||||||
|
@ -541,12 +554,6 @@ impl Readable for PaymentId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::fmt::Display for PaymentId {
|
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
|
||||||
crate::util::logger::DebugBytes(&self.0).fmt(f)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An identifier used to uniquely identify an intercepted HTLC to LDK.
|
/// An identifier used to uniquely identify an intercepted HTLC to LDK.
|
||||||
///
|
///
|
||||||
/// This is not exported to bindings users as we just use [u8; 32] directly
|
/// This is not exported to bindings users as we just use [u8; 32] directly
|
||||||
|
|
Loading…
Add table
Reference in a new issue