77
77
//! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
78
78
//! [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder
79
79
80
+ use core:: borrow:: Borrow ;
80
81
use bitcoin:: constants:: ChainHash ;
81
82
use bitcoin:: network:: Network ;
82
83
use bitcoin:: secp256k1:: { Keypair , PublicKey , Secp256k1 , self } ;
@@ -111,12 +112,13 @@ use crate::prelude::*;
111
112
112
113
#[ cfg( feature = "std" ) ]
113
114
use std:: time:: SystemTime ;
115
+ use bitcoin:: hex:: impl_fmt_traits;
114
116
115
117
pub ( super ) const IV_BYTES_WITH_METADATA : & [ u8 ; IV_LEN ] = b"LDK Offer ~~~~~~" ;
116
118
pub ( super ) const IV_BYTES_WITHOUT_METADATA : & [ u8 ; IV_LEN ] = b"LDK Offer v2~~~~" ;
117
119
118
120
/// An identifier for an [`Offer`] built using [`DerivedMetadata`].
119
- #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
121
+ #[ derive( Clone , Copy , Eq , PartialEq ) ]
120
122
pub struct OfferId ( pub [ u8 ; 32 ] ) ;
121
123
122
124
impl OfferId {
@@ -134,6 +136,18 @@ impl OfferId {
134
136
}
135
137
}
136
138
139
+ impl Borrow < [ u8 ] > for OfferId {
140
+ fn borrow ( & self ) -> & [ u8 ] {
141
+ & self . 0 [ ..]
142
+ }
143
+ }
144
+
145
+ impl_fmt_traits ! {
146
+ impl fmt_traits for OfferId {
147
+ const LENGTH : usize = 32 ;
148
+ }
149
+ }
150
+
137
151
impl Writeable for OfferId {
138
152
fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
139
153
self . 0 . write ( w)
0 commit comments