@@ -265,7 +265,6 @@ impl Offer {
265265 self . send_invoice . as_ref ( )
266266 }
267267
268- #[ cfg( test) ]
269268 fn as_bytes ( & self ) -> & [ u8 ] {
270269 & self . bytes
271270 }
@@ -363,8 +362,8 @@ impl_writeable!(OnionMessagePath, { node_id, encrypted_recipient_data });
363362
364363type Empty = ( ) ;
365364
366- /// An offer parsed from a bech32-encoded string as a TLV stream and the corresponding bytes. The
367- /// latter is used to compute the offer id .
365+ /// An ` offer` parsed from a bech32-encoded string as a TLV stream and the corresponding bytes. The
366+ /// latter is used to reflect fields in an `invoice_request`, some of which may be unknown .
368367struct ParsedOffer ( OfferTlvStream , Vec < u8 > ) ;
369368
370369/// Error when parsing a bech32 encoded message using [`str::parse`].
@@ -434,7 +433,7 @@ impl TryFrom<ParsedOffer> for Offer {
434433 let ParsedOffer ( OfferTlvStream {
435434 chains, metadata, currency, amount, description, features, absolute_expiry, paths,
436435 issuer, quantity_min, quantity_max, node_id, send_invoice,
437- } , data ) = offer;
436+ } , bytes ) = offer;
438437
439438 let supported_chains = [
440439 genesis_block ( Network :: Bitcoin ) . block_hash ( ) ,
@@ -499,10 +498,8 @@ impl TryFrom<ParsedOffer> for Offer {
499498
500499 let send_invoice = send_invoice. map ( |_| SendInvoice ) ;
501500
502- let id = merkle:: root_hash ( & data) ;
503-
504501 Ok ( Offer {
505- id , chains, metadata, amount, description, features, absolute_expiry, issuer, paths,
502+ bytes , chains, metadata, amount, description, features, absolute_expiry, issuer, paths,
506503 quantity_min, quantity_max, node_id, send_invoice,
507504 } )
508505 }
@@ -537,7 +534,7 @@ impl FromStr for ParsedOffer {
537534impl core:: fmt:: Display for Offer {
538535 fn fmt ( & self , f : & mut core:: fmt:: Formatter ) -> Result < ( ) , core:: fmt:: Error > {
539536 use bitcoin:: bech32:: ToBase32 ;
540- let data = self . to_bytes ( ) . to_base32 ( ) ;
537+ let data = self . as_bytes ( ) . to_base32 ( ) ;
541538 bech32:: encode_without_checksum_to_fmt ( f, OFFER_BECH32_HRP , data) . expect ( "HRP is valid" ) . unwrap ( ) ;
542539
543540 Ok ( ( ) )
0 commit comments