@@ -253,10 +253,10 @@ impl<'a> PayerProofBuilder<'a> {
253253 for r in TlvStream :: new ( & invoice_bytes) . filter ( |r| !SIGNATURE_TYPES . contains ( & r. r#type ) ) {
254254 bytes_without_sig. extend_from_slice ( r. record_bytes ) ;
255255 }
256- let disclosed_fields = extract_disclosed_fields (
257- TlvStream :: new ( & invoice_bytes)
258- . filter ( |r| self . included_types . contains ( & r. r#type ) && !SIGNATURE_TYPES . contains ( & r. r#type ) ) ,
259- ) ?;
256+ let disclosed_fields =
257+ extract_disclosed_fields ( TlvStream :: new ( & invoice_bytes) . filter ( |r| {
258+ self . included_types . contains ( & r. r#type ) && !SIGNATURE_TYPES . contains ( & r. r#type )
259+ } ) ) ?;
260260
261261 let disclosure =
262262 merkle:: compute_selective_disclosure ( & bytes_without_sig, & self . included_types ) ?;
@@ -347,9 +347,9 @@ impl UnsignedPayerProof {
347347 // Preserve TLV ordering by emitting included invoice records below the
348348 // payer-proof range first, then payer-proof TLVs (240..=250), then any
349349 // disclosed experimental invoice records above the reserved range.
350- for record in TlvStream :: new ( & self . invoice_bytes ) . filter ( |r| {
351- self . included_types . contains ( & r. r#type ) && r. r#type < TLV_SIGNATURE
352- } ) {
350+ for record in TlvStream :: new ( & self . invoice_bytes )
351+ . filter ( |r| self . included_types . contains ( & r. r#type ) && r. r#type < TLV_SIGNATURE )
352+ {
353353 bytes. extend_from_slice ( record. record_bytes ) ;
354354 }
355355
@@ -518,12 +518,14 @@ fn update_disclosed_fields(
518518 match record. r#type {
519519 OFFER_DESCRIPTION_TYPE => {
520520 disclosed_fields. offer_description = Some (
521- String :: from_utf8 ( record. value_bytes . to_vec ( ) ) . map_err ( |_| DecodeError :: InvalidValue ) ?,
521+ String :: from_utf8 ( record. value_bytes . to_vec ( ) )
522+ . map_err ( |_| DecodeError :: InvalidValue ) ?,
522523 ) ;
523524 } ,
524525 OFFER_ISSUER_TYPE => {
525526 disclosed_fields. offer_issuer = Some (
526- String :: from_utf8 ( record. value_bytes . to_vec ( ) ) . map_err ( |_| DecodeError :: InvalidValue ) ?,
527+ String :: from_utf8 ( record. value_bytes . to_vec ( ) )
528+ . map_err ( |_| DecodeError :: InvalidValue ) ?,
527529 ) ;
528530 } ,
529531 INVOICE_CREATED_AT_TYPE => {
@@ -757,18 +759,18 @@ impl TryFrom<Vec<u8>> for PayerProof {
757759
758760 Ok ( PayerProof {
759761 bytes,
760- contents : PayerProofContents {
761- payer_id,
762- payment_hash,
763- issuer_signing_pubkey,
764- preimage,
765- invoice_signature,
766- payer_signature,
767- payer_note,
768- disclosed_fields,
769- } ,
770- merkle_root,
771- } )
762+ contents : PayerProofContents {
763+ payer_id,
764+ payment_hash,
765+ issuer_signing_pubkey,
766+ preimage,
767+ invoice_signature,
768+ payer_signature,
769+ payer_note,
770+ disclosed_fields,
771+ } ,
772+ merkle_root,
773+ } )
772774 }
773775}
774776
@@ -903,7 +905,8 @@ mod tests {
903905 b"experimental-payer-proof-field" ,
904906 ) ;
905907
906- let invoice_message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice_bytes) ;
908+ let invoice_message =
909+ TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice_bytes) ;
907910 let invoice_signature =
908911 secp_ctx. sign_schnorr_no_aux_rand ( invoice_message. as_digest ( ) , & issuer_keys) ;
909912
@@ -960,7 +963,8 @@ mod tests {
960963 write_tlv_record_bytes ( & mut invoice_bytes, 1_000_000_001 , b"first-omitted-experimental" ) ;
961964 write_tlv_record_bytes ( & mut invoice_bytes, 1_000_000_003 , b"second-omitted-experimental" ) ;
962965
963- let invoice_message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice_bytes) ;
966+ let invoice_message =
967+ TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice_bytes) ;
964968 let invoice_signature =
965969 secp_ctx. sign_schnorr_no_aux_rand ( invoice_message. as_digest ( ) , & issuer_keys) ;
966970
@@ -1024,7 +1028,8 @@ mod tests {
10241028 ) ;
10251029 write_tlv_record ( & mut invoice_bytes, INVOICE_NODE_ID_TYPE , & issuer_signing_pubkey) ;
10261030
1027- let invoice_message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice_bytes) ;
1031+ let invoice_message =
1032+ TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice_bytes) ;
10281033 let invoice_signature =
10291034 secp_ctx. sign_schnorr_no_aux_rand ( invoice_message. as_digest ( ) , & issuer_keys) ;
10301035
0 commit comments