@@ -91,11 +91,11 @@ use crate::blinded_path::BlindedPath;
91
91
use crate :: ln:: channelmanager:: PaymentId ;
92
92
use crate :: ln:: features:: OfferFeatures ;
93
93
use crate :: ln:: inbound_payment:: { ExpandedKey , IV_LEN , Nonce } ;
94
- use crate :: ln:: msgs:: MAX_VALUE_MSAT ;
94
+ use crate :: ln:: msgs:: { DecodeError , MAX_VALUE_MSAT } ;
95
95
use crate :: offers:: merkle:: TlvStream ;
96
96
use crate :: offers:: parse:: { Bech32Encode , Bolt12ParseError , Bolt12SemanticError , ParsedMessage } ;
97
97
use crate :: offers:: signer:: { Metadata , MetadataMaterial , self } ;
98
- use crate :: util:: ser:: { HighZeroBytesDroppedBigSize , WithoutLength , Writeable , Writer } ;
98
+ use crate :: util:: ser:: { HighZeroBytesDroppedBigSize , Readable , WithoutLength , Writeable , Writer } ;
99
99
use crate :: util:: string:: PrintableString ;
100
100
101
101
#[ cfg( not( c_bindings) ) ]
@@ -892,6 +892,13 @@ impl OfferContents {
892
892
}
893
893
}
894
894
895
+ impl Readable for Offer {
896
+ fn read < R : io:: Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
897
+ let bytes: WithoutLength < Vec < u8 > > = Readable :: read ( reader) ?;
898
+ Self :: try_from ( bytes. 0 ) . map_err ( |_| DecodeError :: InvalidValue )
899
+ }
900
+ }
901
+
895
902
impl Writeable for Offer {
896
903
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
897
904
WithoutLength ( & self . bytes ) . write ( writer)
0 commit comments