Skip to content

Commit 7cbf976

Browse files
committed
f - drop chain from InvoiceRequestFields
1 parent 25c155a commit 7cbf976

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

lightning/src/ln/offers_tests.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
412412
offer_id: offer.id(),
413413
invoice_request: InvoiceRequestFields {
414414
payer_id: invoice_request.payer_id(),
415-
chain: Some(invoice_request.chain()),
416415
amount_msats: None,
417416
features: InvoiceRequestFeatures::empty(),
418417
quantity: None,
@@ -566,7 +565,6 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
566565
offer_id: offer.id(),
567566
invoice_request: InvoiceRequestFields {
568567
payer_id: invoice_request.payer_id(),
569-
chain: Some(invoice_request.chain()),
570568
amount_msats: None,
571569
features: InvoiceRequestFeatures::empty(),
572570
quantity: None,
@@ -689,7 +687,6 @@ fn pays_for_offer_without_blinded_paths() {
689687
offer_id: offer.id(),
690688
invoice_request: InvoiceRequestFields {
691689
payer_id: invoice_request.payer_id(),
692-
chain: Some(invoice_request.chain()),
693690
amount_msats: None,
694691
features: InvoiceRequestFeatures::empty(),
695692
quantity: None,

lightning/src/offers/invoice_request.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -877,13 +877,12 @@ impl VerifiedInvoiceRequest {
877877
let InvoiceRequestContents {
878878
payer_id,
879879
inner: InvoiceRequestContentsWithoutPayerId {
880-
payer: _, offer: _, chain, amount_msats, features, quantity, payer_note
880+
payer: _, offer: _, chain: _, amount_msats, features, quantity, payer_note
881881
},
882882
} = &self.inner.contents;
883883

884884
InvoiceRequestFields {
885885
payer_id: *payer_id,
886-
chain: *chain,
887886
amount_msats: *amount_msats,
888887
features: features.clone(),
889888
quantity: *quantity,
@@ -1127,9 +1126,6 @@ pub struct InvoiceRequestFields {
11271126
/// A possibly transient pubkey used to sign the invoice request.
11281127
pub payer_id: PublicKey,
11291128

1130-
/// A chain from [`Offer::chains`] that the offer is valid for.
1131-
pub chain: Option<ChainHash>,
1132-
11331129
/// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
11341130
/// must be greater than or equal to [`Offer::amount`], converted if necessary.
11351131
///
@@ -1154,11 +1150,10 @@ impl Writeable for InvoiceRequestFields {
11541150
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
11551151
write_tlv_fields!(writer, {
11561152
(0, self.payer_id, required),
1157-
(2, self.chain, option),
1158-
(4, self.amount_msats, option),
1159-
(6, WithoutLength(&self.features), required),
1160-
(8, self.quantity, option),
1161-
(10, self.payer_note_truncated, option),
1153+
(2, self.amount_msats, option),
1154+
(4, WithoutLength(&self.features), required),
1155+
(6, self.quantity, option),
1156+
(8, self.payer_note_truncated, option),
11621157
});
11631158
Ok(())
11641159
}
@@ -1168,17 +1163,15 @@ impl Readable for InvoiceRequestFields {
11681163
fn read<R: io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
11691164
_init_and_read_len_prefixed_tlv_fields!(reader, {
11701165
(0, payer_id, required),
1171-
(2, chain, option),
1172-
(4, amount_msats, option),
1173-
(6, features, (option, encoding: (InvoiceRequestFeatures, WithoutLength))),
1174-
(8, quantity, option),
1175-
(10, payer_note_truncated, option),
1166+
(2, amount_msats, option),
1167+
(4, features, (option, encoding: (InvoiceRequestFeatures, WithoutLength))),
1168+
(6, quantity, option),
1169+
(8, payer_note_truncated, option),
11761170
});
11771171
let features = features.unwrap_or(InvoiceRequestFeatures::empty());
11781172

11791173
Ok(InvoiceRequestFields {
1180-
payer_id: payer_id.0.unwrap(), chain, amount_msats, features, quantity,
1181-
payer_note_truncated,
1174+
payer_id: payer_id.0.unwrap(), amount_msats, features, quantity, payer_note_truncated,
11821175
})
11831176
}
11841177
}
@@ -2282,7 +2275,6 @@ mod tests {
22822275
invoice_request.fields(),
22832276
InvoiceRequestFields {
22842277
payer_id: payer_pubkey(),
2285-
chain: Some(ChainHash::using_genesis_block(Network::Testnet)),
22862278
amount_msats: Some(1001),
22872279
features: InvoiceRequestFeatures::empty(),
22882280
quantity: Some(1),

0 commit comments

Comments
 (0)