]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Merge pull request #3237 from jkczyz/2024-08-offers-experimental-tlvs
authorJeffrey Czyz <jkczyz@gmail.com>
Tue, 5 Nov 2024 17:37:02 +0000 (11:37 -0600)
committerGitHub <noreply@github.com>
Tue, 5 Nov 2024 17:37:02 +0000 (11:37 -0600)
Experimental offer TLVs

1  2 
lightning/src/offers/invoice.rs
lightning/src/offers/invoice_request.rs
lightning/src/offers/offer.rs
lightning/src/offers/refund.rs
lightning/src/offers/static_invoice.rs
lightning/src/util/ser.rs

index 844018012c1c2928b02019a4aa4a69774632c5fe,ab5ff78984c874dba60deed58229e6bbe784d6e5..b1d7660f2240764b207e06dd9913957fbbb0013b
@@@ -1453,13 -1606,13 +1606,13 @@@ mod tests 
        use crate::blinded_path::BlindedHop;
        use crate::blinded_path::message::BlindedMessagePath;
        use crate::sign::KeyMaterial;
 -      use crate::ln::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures};
 +      use crate::types::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures};
        use crate::ln::inbound_payment::ExpandedKey;
        use crate::ln::msgs::DecodeError;
-       use crate::offers::invoice_request::InvoiceRequestTlvStreamRef;
-       use crate::offers::merkle::{SignError, SignatureTlvStreamRef, TaggedHash, self};
+       use crate::offers::invoice_request::{ExperimentalInvoiceRequestTlvStreamRef, InvoiceRequestTlvStreamRef};
+       use crate::offers::merkle::{SignError, SignatureTlvStreamRef, TaggedHash, TlvStream, self};
        use crate::offers::nonce::Nonce;
-       use crate::offers::offer::{Amount, OfferTlvStreamRef, Quantity};
+       use crate::offers::offer::{Amount, ExperimentalOfferTlvStreamRef, OfferTlvStreamRef, Quantity};
        use crate::prelude::*;
        #[cfg(not(c_bindings))]
        use {
index fed8bfee27f9bd2c0382ae38aa88fd385bcdc4bb,3c369feacebf5456bcedb31b8e94e7ed890ffcc2..d1ab6d067d90d88ef84156763fbe8ff878998b29
@@@ -64,14 -64,14 +64,14 @@@ use bitcoin::secp256k1::schnorr::Signat
  use crate::io;
  use crate::blinded_path::message::BlindedMessagePath;
  use crate::blinded_path::payment::BlindedPaymentPath;
 -use crate::ln::types::PaymentHash;
 +use crate::types::payment::PaymentHash;
  use crate::ln::channelmanager::PaymentId;
 -use crate::ln::features::InvoiceRequestFeatures;
 +use crate::types::features::InvoiceRequestFeatures;
  use crate::ln::inbound_payment::{ExpandedKey, IV_LEN};
  use crate::ln::msgs::DecodeError;
- use crate::offers::merkle::{SignError, SignFn, SignatureTlvStream, SignatureTlvStreamRef, TaggedHash, self};
+ use crate::offers::merkle::{SignError, SignFn, SignatureTlvStream, SignatureTlvStreamRef, TaggedHash, TlvStream, self, SIGNATURE_TLV_RECORD_SIZE};
  use crate::offers::nonce::Nonce;
- use crate::offers::offer::{Offer, OfferContents, OfferId, OfferTlvStream, OfferTlvStreamRef};
+ use crate::offers::offer::{EXPERIMENTAL_OFFER_TYPES, ExperimentalOfferTlvStream, ExperimentalOfferTlvStreamRef, OFFER_TYPES, Offer, OfferContents, OfferId, OfferTlvStream, OfferTlvStreamRef};
  use crate::offers::parse::{Bolt12ParseError, ParsedMessage, Bolt12SemanticError};
  use crate::offers::payer::{PayerContents, PayerTlvStream, PayerTlvStreamRef};
  use crate::offers::signer::{Metadata, MetadataMaterial};
index 0880e369eed02f90e221dfc7ec62a5d9b74e418f,8d999ff8084f3dceae14a6593bd0e23cd58cc1fc..4efd0096cfee024c44a42e21a4a743d994097283
@@@ -88,10 -87,10 +88,10 @@@ use core::time::Duration
  use crate::io;
  use crate::blinded_path::message::BlindedMessagePath;
  use crate::ln::channelmanager::PaymentId;
 -use crate::ln::features::OfferFeatures;
 +use crate::types::features::OfferFeatures;
  use crate::ln::inbound_payment::{ExpandedKey, IV_LEN};
  use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
- use crate::offers::merkle::{TaggedHash, TlvStream};
+ use crate::offers::merkle::{TaggedHash, TlvRecord, TlvStream};
  use crate::offers::nonce::Nonce;
  use crate::offers::parse::{Bech32Encode, Bolt12ParseError, Bolt12SemanticError, ParsedMessage};
  use crate::offers::signer::{Metadata, MetadataMaterial, self};
index 8d76534ff6d4bbae8b71b22fa28b57333ed725fa,e538ab77f45ad70aed1455ae35c9ba5a89f0fb0b..b1f5b0520ca162dd003f00e8af75953f67238d8b
@@@ -93,14 -93,14 +93,14 @@@ use crate::sign::EntropySource
  use crate::io;
  use crate::blinded_path::message::BlindedMessagePath;
  use crate::blinded_path::payment::BlindedPaymentPath;
 -use crate::ln::types::PaymentHash;
 +use crate::types::payment::PaymentHash;
  use crate::ln::channelmanager::PaymentId;
 -use crate::ln::features::InvoiceRequestFeatures;
 +use crate::types::features::InvoiceRequestFeatures;
  use crate::ln::inbound_payment::{ExpandedKey, IV_LEN};
  use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
- use crate::offers::invoice_request::{InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef};
+ use crate::offers::invoice_request::{ExperimentalInvoiceRequestTlvStream, ExperimentalInvoiceRequestTlvStreamRef, InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef};
  use crate::offers::nonce::Nonce;
- use crate::offers::offer::{OfferTlvStream, OfferTlvStreamRef};
+ use crate::offers::offer::{ExperimentalOfferTlvStream, ExperimentalOfferTlvStreamRef, OfferTlvStream, OfferTlvStreamRef};
  use crate::offers::parse::{Bech32Encode, Bolt12ParseError, Bolt12SemanticError, ParsedMessage};
  use crate::offers::payer::{PayerContents, PayerTlvStream, PayerTlvStreamRef};
  use crate::offers::signer::{Metadata, MetadataMaterial, self};
@@@ -941,12 -994,12 +994,12 @@@ mod tests 
        use crate::blinded_path::message::BlindedMessagePath;
        use crate::sign::KeyMaterial;
        use crate::ln::channelmanager::PaymentId;
 -      use crate::ln::features::{InvoiceRequestFeatures, OfferFeatures};
 +      use crate::types::features::{InvoiceRequestFeatures, OfferFeatures};
        use crate::ln::inbound_payment::ExpandedKey;
        use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
-       use crate::offers::invoice_request::InvoiceRequestTlvStreamRef;
+       use crate::offers::invoice_request::{EXPERIMENTAL_INVOICE_REQUEST_TYPES, ExperimentalInvoiceRequestTlvStreamRef, INVOICE_REQUEST_TYPES, InvoiceRequestTlvStreamRef};
        use crate::offers::nonce::Nonce;
-       use crate::offers::offer::OfferTlvStreamRef;
+       use crate::offers::offer::{ExperimentalOfferTlvStreamRef, OfferTlvStreamRef};
        use crate::offers::parse::{Bolt12ParseError, Bolt12SemanticError};
        use crate::offers::payer::PayerTlvStreamRef;
        use crate::offers::test_utils::*;
index 107e9c6989282879598904d80a132ddeb1bec9d3,b3618ae5d989045213339ff96de8a63c665ffcd9..50655c392c8daded941f0d2ad1d7ca782bf7916f
@@@ -25,10 -30,10 +29,11 @@@ use crate::offers::merkle::
  };
  use crate::offers::nonce::Nonce;
  use crate::offers::offer::{
-       Amount, Offer, OfferContents, OfferTlvStream, OfferTlvStreamRef, Quantity, OFFER_TYPES,
+       Amount, ExperimentalOfferTlvStream, ExperimentalOfferTlvStreamRef, Offer, OfferContents,
+       OfferTlvStream, OfferTlvStreamRef, Quantity, EXPERIMENTAL_OFFER_TYPES, OFFER_TYPES,
  };
  use crate::offers::parse::{Bolt12ParseError, Bolt12SemanticError, ParsedMessage};
 +use crate::types::features::{Bolt12InvoiceFeatures, OfferFeatures};
  use crate::util::ser::{CursorReadable, Iterable, WithoutLength, Writeable, Writer};
  use crate::util::string::PrintableString;
  use bitcoin::address::Address;
@@@ -603,16 -702,23 +702,22 @@@ impl TryFrom<PartialInvoiceTlvStream> f
  mod tests {
        use crate::blinded_path::message::BlindedMessagePath;
        use crate::blinded_path::BlindedHop;
 -      use crate::ln::features::{Bolt12InvoiceFeatures, OfferFeatures};
        use crate::ln::inbound_payment::ExpandedKey;
        use crate::ln::msgs::DecodeError;
-       use crate::offers::invoice::InvoiceTlvStreamRef;
+       use crate::offers::invoice::{
+               ExperimentalInvoiceTlvStreamRef, InvoiceTlvStreamRef, EXPERIMENTAL_INVOICE_TYPES,
+               INVOICE_TYPES,
+       };
        use crate::offers::merkle;
-       use crate::offers::merkle::{SignatureTlvStreamRef, TaggedHash};
+       use crate::offers::merkle::{SignatureTlvStreamRef, TaggedHash, TlvStream};
        use crate::offers::nonce::Nonce;
-       use crate::offers::offer::{Offer, OfferBuilder, OfferTlvStreamRef, Quantity};
+       use crate::offers::offer::{
+               ExperimentalOfferTlvStreamRef, Offer, OfferBuilder, OfferTlvStreamRef, Quantity,
+       };
        use crate::offers::parse::{Bolt12ParseError, Bolt12SemanticError};
        use crate::offers::static_invoice::{
-               StaticInvoice, StaticInvoiceBuilder, DEFAULT_RELATIVE_EXPIRY, SIGNATURE_TAG,
+               StaticInvoice, StaticInvoiceBuilder, UnsignedStaticInvoice, DEFAULT_RELATIVE_EXPIRY,
+               SIGNATURE_TAG,
        };
        use crate::offers::test_utils::*;
        use crate::sign::KeyMaterial;
Simple merge