@@ -85,7 +85,8 @@ impl<'a> InvoiceBuilder<'a> {
85
85
invoice_request : invoice_request. contents . clone ( ) ,
86
86
fields : InvoiceFields {
87
87
paths, payinfo, created_at, relative_expiry : None , payment_hash, amount_msats,
88
- fallbacks : None , features : Bolt12InvoiceFeatures :: empty ( ) , code : None ,
88
+ fallbacks : None , features : Bolt12InvoiceFeatures :: empty ( ) ,
89
+ signing_pubkey : invoice_request. contents . offer . signing_pubkey ( ) ,
89
90
} ,
90
91
} ,
91
92
} )
@@ -192,7 +193,7 @@ impl<'a> UnsignedInvoice<'a> {
192
193
let mut bytes = Vec :: new ( ) ;
193
194
unsigned_tlv_stream. write ( & mut bytes) . unwrap ( ) ;
194
195
195
- let pubkey = self . invoice . signing_pubkey ( ) ;
196
+ let pubkey = self . invoice . fields ( ) . signing_pubkey ;
196
197
let signature = merkle:: sign_message ( sign, SIGNATURE_TAG , & bytes, pubkey) ?;
197
198
198
199
// Append the signature TLV record to the bytes.
@@ -204,7 +205,7 @@ impl<'a> UnsignedInvoice<'a> {
204
205
Ok ( Invoice {
205
206
bytes,
206
207
contents : self . invoice ,
207
- signature : Some ( signature ) ,
208
+ signature,
208
209
} )
209
210
}
210
211
}
@@ -386,15 +387,6 @@ impl InvoiceContents {
386
387
}
387
388
}
388
389
389
- fn signing_pubkey ( & self ) -> PublicKey {
390
- match self {
391
- InvoiceContents :: ForOffer { invoice_request, .. } => {
392
- invoice_request. offer . signing_pubkey ( )
393
- } ,
394
- InvoiceContents :: ForRefund { .. } => unreachable ! ( ) ,
395
- }
396
- }
397
-
398
390
fn fields ( & self ) -> & InvoiceFields {
399
391
match self {
400
392
InvoiceContents :: ForOffer { fields, .. } => fields,
@@ -436,7 +428,7 @@ impl InvoiceFields {
436
428
amount : Some ( self . amount_msats ) ,
437
429
fallbacks : self . fallbacks . as_ref ( ) ,
438
430
features,
439
- code : self . code . as_ref ( ) ,
431
+ node_id : Some ( & self . signing_pubkey ) ,
440
432
}
441
433
}
442
434
}
0 commit comments