Skip to content

Commit 1a1a930

Browse files
committed
Rename InvoiceRequest::payer_id
For consistency with Offer::issuer_signing_pubkey, rename InvoiceRequest::payer_id to use "signing_pubkey" instead of "id".
1 parent 869366c commit 1a1a930

File tree

10 files changed

+161
-160
lines changed

10 files changed

+161
-160
lines changed

fuzz/src/invoice_request_deser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
8585
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
8686
offer_id: OfferId([42; 32]),
8787
invoice_request: InvoiceRequestFields {
88-
payer_id: invoice_request.payer_id(),
88+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
8989
quantity: invoice_request.quantity(),
9090
payer_note_truncated: invoice_request
9191
.payer_note()

lightning/src/ln/channelmanager.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ use crate::ln::outbound_payment::{OutboundPayments, PaymentAttempts, PendingOutb
6565
use crate::ln::wire::Encode;
6666
use crate::offers::invoice::{Bolt12Invoice, DEFAULT_RELATIVE_EXPIRY, DerivedSigningPubkey, ExplicitSigningPubkey, InvoiceBuilder, UnsignedBolt12Invoice};
6767
use crate::offers::invoice_error::InvoiceError;
68-
use crate::offers::invoice_request::{DerivedPayerId, InvoiceRequestBuilder};
68+
use crate::offers::invoice_request::{DerivedPayerSigningPubkey, InvoiceRequestBuilder};
6969
use crate::offers::nonce::Nonce;
7070
use crate::offers::offer::{Offer, OfferBuilder};
7171
use crate::offers::parse::Bolt12SemanticError;
@@ -9065,8 +9065,8 @@ where
90659065
let secp_ctx = &self.secp_ctx;
90669066

90679067
let nonce = Nonce::from_entropy_source(entropy);
9068-
let builder: InvoiceRequestBuilder<DerivedPayerId, secp256k1::All> = offer
9069-
.request_invoice_deriving_payer_id(expanded_key, nonce, secp_ctx, payment_id)?
9068+
let builder: InvoiceRequestBuilder<DerivedPayerSigningPubkey, secp256k1::All> = offer
9069+
.request_invoice_deriving_signing_pubkey(expanded_key, nonce, secp_ctx, payment_id)?
90709070
.into();
90719071
let builder = builder.chain_hash(self.chain_hash)?;
90729072

lightning/src/ln/offers_tests.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -565,13 +565,13 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
565565
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
566566
offer_id: offer.id(),
567567
invoice_request: InvoiceRequestFields {
568-
payer_id: invoice_request.payer_id(),
568+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
569569
quantity: None,
570570
payer_note_truncated: None,
571571
},
572572
});
573573
assert_eq!(invoice_request.amount_msats(), None);
574-
assert_ne!(invoice_request.payer_id(), david_id);
574+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
575575
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
576576

577577
let onion_message = alice.onion_messenger.next_onion_message_for_peer(charlie_id).unwrap();
@@ -714,13 +714,13 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
714714
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
715715
offer_id: offer.id(),
716716
invoice_request: InvoiceRequestFields {
717-
payer_id: invoice_request.payer_id(),
717+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
718718
quantity: None,
719719
payer_note_truncated: None,
720720
},
721721
});
722722
assert_eq!(invoice_request.amount_msats(), None);
723-
assert_ne!(invoice_request.payer_id(), bob_id);
723+
assert_ne!(invoice_request.payer_signing_pubkey(), bob_id);
724724
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(bob_id));
725725

726726
let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
@@ -832,7 +832,7 @@ fn pays_for_offer_without_blinded_paths() {
832832
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
833833
offer_id: offer.id(),
834834
invoice_request: InvoiceRequestFields {
835-
payer_id: invoice_request.payer_id(),
835+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
836836
quantity: None,
837837
payer_note_truncated: None,
838838
},
@@ -1090,7 +1090,7 @@ fn pays_bolt12_invoice_asynchronously() {
10901090
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
10911091
offer_id: offer.id(),
10921092
invoice_request: InvoiceRequestFields {
1093-
payer_id: invoice_request.payer_id(),
1093+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
10941094
quantity: None,
10951095
payer_note_truncated: None,
10961096
},
@@ -1179,12 +1179,12 @@ fn creates_offer_with_blinded_path_using_unannounced_introduction_node() {
11791179
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
11801180
offer_id: offer.id(),
11811181
invoice_request: InvoiceRequestFields {
1182-
payer_id: invoice_request.payer_id(),
1182+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
11831183
quantity: None,
11841184
payer_note_truncated: None,
11851185
},
11861186
});
1187-
assert_ne!(invoice_request.payer_id(), bob_id);
1187+
assert_ne!(invoice_request.payer_signing_pubkey(), bob_id);
11881188
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(alice_id));
11891189

11901190
let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
@@ -1324,7 +1324,7 @@ fn fails_authentication_when_handling_invoice_request() {
13241324

13251325
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
13261326
assert_eq!(invoice_request.amount_msats(), None);
1327-
assert_ne!(invoice_request.payer_id(), david_id);
1327+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
13281328
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
13291329

13301330
assert_eq!(alice.onion_messenger.next_onion_message_for_peer(charlie_id), None);
@@ -1354,7 +1354,7 @@ fn fails_authentication_when_handling_invoice_request() {
13541354

13551355
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
13561356
assert_eq!(invoice_request.amount_msats(), None);
1357-
assert_ne!(invoice_request.payer_id(), david_id);
1357+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
13581358
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
13591359

13601360
assert_eq!(alice.onion_messenger.next_onion_message_for_peer(charlie_id), None);
@@ -1456,7 +1456,7 @@ fn fails_authentication_when_handling_invoice_for_offer() {
14561456

14571457
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
14581458
assert_eq!(invoice_request.amount_msats(), None);
1459-
assert_ne!(invoice_request.payer_id(), david_id);
1459+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
14601460
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
14611461

14621462
let onion_message = alice.onion_messenger.next_onion_message_for_peer(charlie_id).unwrap();

lightning/src/offers/invoice.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,8 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
749749
/// refund in case there are no [`message_paths`].
750750
///
751751
/// [`message_paths`]: Self::message_paths
752-
pub fn payer_id(&$self) -> PublicKey {
753-
$contents.payer_id()
752+
pub fn payer_signing_pubkey(&$self) -> PublicKey {
753+
$contents.payer_signing_pubkey()
754754
}
755755

756756
/// A payer-provided note reflected back in the invoice.
@@ -1017,10 +1017,10 @@ impl InvoiceContents {
10171017
}
10181018
}
10191019

1020-
fn payer_id(&self) -> PublicKey {
1020+
fn payer_signing_pubkey(&self) -> PublicKey {
10211021
match self {
1022-
InvoiceContents::ForOffer { invoice_request, .. } => invoice_request.payer_id(),
10231022
InvoiceContents::ForRefund { refund, .. } => refund.payer_id(),
1023+
InvoiceContents::ForOffer { invoice_request, .. } => invoice_request.payer_signing_pubkey(),
10241024
}
10251025
}
10261026

@@ -1099,9 +1099,9 @@ impl InvoiceContents {
10991099
});
11001100
let tlv_stream = offer_records.chain(invreq_records);
11011101

1102-
let payer_id = self.payer_id();
1102+
let signing_pubkey = self.payer_signing_pubkey();
11031103
signer::verify_payer_metadata(
1104-
metadata.as_ref(), key, iv_bytes, payer_id, tlv_stream, secp_ctx,
1104+
metadata.as_ref(), key, iv_bytes, signing_pubkey, tlv_stream, secp_ctx,
11051105
)
11061106
}
11071107

@@ -1526,7 +1526,7 @@ mod tests {
15261526
assert_eq!(unsigned_invoice.amount_msats(), 1000);
15271527
assert_eq!(unsigned_invoice.invoice_request_features(), &InvoiceRequestFeatures::empty());
15281528
assert_eq!(unsigned_invoice.quantity(), None);
1529-
assert_eq!(unsigned_invoice.payer_id(), payer_pubkey());
1529+
assert_eq!(unsigned_invoice.payer_signing_pubkey(), payer_pubkey());
15301530
assert_eq!(unsigned_invoice.payer_note(), None);
15311531
assert_eq!(unsigned_invoice.payment_paths(), payment_paths.as_slice());
15321532
assert_eq!(unsigned_invoice.created_at(), now);
@@ -1568,7 +1568,7 @@ mod tests {
15681568
assert_eq!(invoice.amount_msats(), 1000);
15691569
assert_eq!(invoice.invoice_request_features(), &InvoiceRequestFeatures::empty());
15701570
assert_eq!(invoice.quantity(), None);
1571-
assert_eq!(invoice.payer_id(), payer_pubkey());
1571+
assert_eq!(invoice.payer_signing_pubkey(), payer_pubkey());
15721572
assert_eq!(invoice.payer_note(), None);
15731573
assert_eq!(invoice.payment_paths(), payment_paths.as_slice());
15741574
assert_eq!(invoice.created_at(), now);
@@ -1666,7 +1666,7 @@ mod tests {
16661666
assert_eq!(invoice.amount_msats(), 1000);
16671667
assert_eq!(invoice.invoice_request_features(), &InvoiceRequestFeatures::empty());
16681668
assert_eq!(invoice.quantity(), None);
1669-
assert_eq!(invoice.payer_id(), payer_pubkey());
1669+
assert_eq!(invoice.payer_signing_pubkey(), payer_pubkey());
16701670
assert_eq!(invoice.payer_note(), None);
16711671
assert_eq!(invoice.payment_paths(), payment_paths.as_slice());
16721672
assert_eq!(invoice.created_at(), now);

0 commit comments

Comments
 (0)