@@ -75,7 +75,8 @@ impl<'a> InvoiceBuilder<'a> {
75
75
fields : InvoiceFields {
76
76
paths, payinfo, created_at, relative_expiry : None , payment_hash,
77
77
amount_msats : invoice_request. amount_msats ( ) , fallbacks : None ,
78
- features : Bolt12InvoiceFeatures :: empty ( ) , code : None ,
78
+ features : Bolt12InvoiceFeatures :: empty ( ) ,
79
+ signing_pubkey : invoice_request. contents . offer . signing_pubkey ( ) ,
79
80
} ,
80
81
} ,
81
82
} )
@@ -182,7 +183,7 @@ impl<'a> UnsignedInvoice<'a> {
182
183
let mut bytes = Vec :: new ( ) ;
183
184
unsigned_tlv_stream. write ( & mut bytes) . unwrap ( ) ;
184
185
185
- let pubkey = self . invoice . signing_pubkey ( ) ;
186
+ let pubkey = self . invoice . fields ( ) . signing_pubkey ;
186
187
let signature = merkle:: sign_message ( sign, SIGNATURE_TAG , & bytes, pubkey) ?;
187
188
188
189
// Append the signature TLV record to the bytes.
@@ -194,7 +195,7 @@ impl<'a> UnsignedInvoice<'a> {
194
195
Ok ( Invoice {
195
196
bytes,
196
197
contents : self . invoice ,
197
- signature : Some ( signature ) ,
198
+ signature,
198
199
} )
199
200
}
200
201
}
@@ -376,15 +377,6 @@ impl InvoiceContents {
376
377
}
377
378
}
378
379
379
- fn signing_pubkey ( & self ) -> PublicKey {
380
- match self {
381
- InvoiceContents :: ForOffer { invoice_request, .. } => {
382
- invoice_request. offer . signing_pubkey ( )
383
- } ,
384
- InvoiceContents :: ForRefund { .. } => unreachable ! ( ) ,
385
- }
386
- }
387
-
388
380
fn fields ( & self ) -> & InvoiceFields {
389
381
match self {
390
382
InvoiceContents :: ForOffer { fields, .. } => fields,
@@ -426,7 +418,7 @@ impl InvoiceFields {
426
418
amount : Some ( self . amount_msats ) ,
427
419
fallbacks : self . fallbacks . as_ref ( ) ,
428
420
features,
429
- code : self . code . as_ref ( ) ,
421
+ node_id : Some ( & self . signing_pubkey ) ,
430
422
}
431
423
}
432
424
}
0 commit comments