From: Jeffrey Czyz Date: Tue, 5 Nov 2024 17:37:02 +0000 (-0600) Subject: Merge pull request #3237 from jkczyz/2024-08-offers-experimental-tlvs X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=cb650a860657a861f36e6f25ff0a6024bd792ec1;p=rust-lightning Merge pull request #3237 from jkczyz/2024-08-offers-experimental-tlvs Experimental offer TLVs --- cb650a860657a861f36e6f25ff0a6024bd792ec1 diff --cc lightning/src/offers/invoice.rs index 844018012,ab5ff7898..b1d7660f2 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@@ -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 { diff --cc lightning/src/offers/invoice_request.rs index fed8bfee2,3c369feac..d1ab6d067 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@@ -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}; diff --cc lightning/src/offers/offer.rs index 0880e369e,8d999ff80..4efd0096c --- a/lightning/src/offers/offer.rs +++ b/lightning/src/offers/offer.rs @@@ -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}; diff --cc lightning/src/offers/refund.rs index 8d76534ff,e538ab77f..b1f5b0520 --- a/lightning/src/offers/refund.rs +++ b/lightning/src/offers/refund.rs @@@ -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::*; diff --cc lightning/src/offers/static_invoice.rs index 107e9c698,b3618ae5d..50655c392 --- a/lightning/src/offers/static_invoice.rs +++ b/lightning/src/offers/static_invoice.rs @@@ -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 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;