Skip to content

Commit 76a1e6b

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 e8a50a7 commit 76a1e6b

File tree

10 files changed

+163
-162
lines changed

10 files changed

+163
-162
lines changed

fuzz/src/invoice_request_deser.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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, InvoiceRequest, InvoiceRequestBuilder};
68+
use crate::offers::invoice_request::{DerivedPayerSigningPubkey, InvoiceRequest, InvoiceRequestBuilder};
6969
use crate::offers::nonce::Nonce;
7070
use crate::offers::offer::{Offer, OfferBuilder};
7171
use crate::offers::parse::Bolt12SemanticError;
@@ -9226,8 +9226,8 @@ where
92269226
let secp_ctx = &self.secp_ctx;
92279227

92289228
let nonce = Nonce::from_entropy_source(entropy);
9229-
let builder: InvoiceRequestBuilder<DerivedPayerId, secp256k1::All> = offer
9230-
.request_invoice_deriving_payer_id(expanded_key, nonce, secp_ctx, payment_id)?
9229+
let builder: InvoiceRequestBuilder<DerivedPayerSigningPubkey, secp256k1::All> = offer
9230+
.request_invoice_deriving_signing_pubkey(expanded_key, nonce, secp_ctx, payment_id)?
92319231
.into();
92329232
let builder = builder.chain_hash(self.chain_hash)?;
92339233

lightning/src/ln/offers_tests.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,13 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
566566
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
567567
offer_id: offer.id(),
568568
invoice_request: InvoiceRequestFields {
569-
payer_id: invoice_request.payer_id(),
569+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
570570
quantity: None,
571571
payer_note_truncated: None,
572572
},
573573
});
574574
assert_eq!(invoice_request.amount_msats(), None);
575-
assert_ne!(invoice_request.payer_id(), david_id);
575+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
576576
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
577577

578578
let onion_message = alice.onion_messenger.next_onion_message_for_peer(charlie_id).unwrap();
@@ -726,13 +726,13 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
726726
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
727727
offer_id: offer.id(),
728728
invoice_request: InvoiceRequestFields {
729-
payer_id: invoice_request.payer_id(),
729+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
730730
quantity: None,
731731
payer_note_truncated: None,
732732
},
733733
});
734734
assert_eq!(invoice_request.amount_msats(), None);
735-
assert_ne!(invoice_request.payer_id(), bob_id);
735+
assert_ne!(invoice_request.payer_signing_pubkey(), bob_id);
736736
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(bob_id));
737737

738738
let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
@@ -846,7 +846,7 @@ fn pays_for_offer_without_blinded_paths() {
846846
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
847847
offer_id: offer.id(),
848848
invoice_request: InvoiceRequestFields {
849-
payer_id: invoice_request.payer_id(),
849+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
850850
quantity: None,
851851
payer_note_truncated: None,
852852
},
@@ -1112,13 +1112,13 @@ fn creates_and_pays_for_offer_with_retry() {
11121112
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
11131113
offer_id: offer.id(),
11141114
invoice_request: InvoiceRequestFields {
1115-
payer_id: invoice_request.payer_id(),
1115+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
11161116
quantity: None,
11171117
payer_note_truncated: None,
11181118
},
11191119
});
11201120
assert_eq!(invoice_request.amount_msats(), None);
1121-
assert_ne!(invoice_request.payer_id(), bob_id);
1121+
assert_ne!(invoice_request.payer_signing_pubkey(), bob_id);
11221122
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(bob_id));
11231123
let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
11241124
bob.onion_messenger.handle_onion_message(alice_id, &onion_message);
@@ -1176,7 +1176,7 @@ fn pays_bolt12_invoice_asynchronously() {
11761176
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
11771177
offer_id: offer.id(),
11781178
invoice_request: InvoiceRequestFields {
1179-
payer_id: invoice_request.payer_id(),
1179+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
11801180
quantity: None,
11811181
payer_note_truncated: None,
11821182
},
@@ -1265,12 +1265,12 @@ fn creates_offer_with_blinded_path_using_unannounced_introduction_node() {
12651265
let payment_context = PaymentContext::Bolt12Offer(Bolt12OfferContext {
12661266
offer_id: offer.id(),
12671267
invoice_request: InvoiceRequestFields {
1268-
payer_id: invoice_request.payer_id(),
1268+
payer_signing_pubkey: invoice_request.payer_signing_pubkey(),
12691269
quantity: None,
12701270
payer_note_truncated: None,
12711271
},
12721272
});
1273-
assert_ne!(invoice_request.payer_id(), bob_id);
1273+
assert_ne!(invoice_request.payer_signing_pubkey(), bob_id);
12741274
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(alice_id));
12751275

12761276
let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
@@ -1411,7 +1411,7 @@ fn fails_authentication_when_handling_invoice_request() {
14111411

14121412
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
14131413
assert_eq!(invoice_request.amount_msats(), None);
1414-
assert_ne!(invoice_request.payer_id(), david_id);
1414+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
14151415
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
14161416

14171417
assert_eq!(alice.onion_messenger.next_onion_message_for_peer(charlie_id), None);
@@ -1441,7 +1441,7 @@ fn fails_authentication_when_handling_invoice_request() {
14411441

14421442
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
14431443
assert_eq!(invoice_request.amount_msats(), None);
1444-
assert_ne!(invoice_request.payer_id(), david_id);
1444+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
14451445
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
14461446

14471447
assert_eq!(alice.onion_messenger.next_onion_message_for_peer(charlie_id), None);
@@ -1543,7 +1543,7 @@ fn fails_authentication_when_handling_invoice_for_offer() {
15431543

15441544
let (invoice_request, reply_path) = extract_invoice_request(alice, &onion_message);
15451545
assert_eq!(invoice_request.amount_msats(), None);
1546-
assert_ne!(invoice_request.payer_id(), david_id);
1546+
assert_ne!(invoice_request.payer_signing_pubkey(), david_id);
15471547
assert_eq!(reply_path.introduction_node(), &IntroductionNode::NodeId(charlie_id));
15481548

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

lightning/src/offers/invoice.rs

Lines changed: 9 additions & 9 deletions
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)