From 4e770afd488a7c5468387e4f5212ae287a942c25 Mon Sep 17 00:00:00 2001 From: Philip Kannegaard Hayes Date: Fri, 16 May 2025 17:30:44 -0700 Subject: [PATCH 1/2] offers: box `*Contents`. reduce size_of `Event` 1856 -> 1072 Prep for inline storage for `description`, `issuer`, `payer_note` * invoice: box `InvoiceContents` reduces `mem::size_of::()` : 1856 -> 1072 * invoice_request: box contents * offer: box `OfferContents` * refund: box `RefundContents` * static invoice: box `InvoiceContents` --- lightning/src/offers/invoice.rs | 50 ++++++++++++------------- lightning/src/offers/invoice_request.rs | 36 +++++++++--------- lightning/src/offers/offer.rs | 18 ++++----- lightning/src/offers/refund.rs | 16 ++++---- lightning/src/offers/static_invoice.rs | 23 +++++++----- 5 files changed, 73 insertions(+), 70 deletions(-) diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index 3615850a22e..4c871a566a5 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -184,7 +184,7 @@ pub const SIGNATURE_TAG: &'static str = concat!("lightning", "invoice", "signatu /// [module-level documentation]: self pub struct InvoiceBuilder<'a, S: SigningPubkeyStrategy> { invreq_bytes: &'a Vec, - invoice: InvoiceContents, + invoice: Box, signing_pubkey_strategy: S, } @@ -200,7 +200,7 @@ pub struct InvoiceBuilder<'a, S: SigningPubkeyStrategy> { #[cfg(c_bindings)] pub struct InvoiceWithExplicitSigningPubkeyBuilder<'a> { invreq_bytes: &'a Vec, - invoice: InvoiceContents, + invoice: Box, signing_pubkey_strategy: ExplicitSigningPubkey, } @@ -216,7 +216,7 @@ pub struct InvoiceWithExplicitSigningPubkeyBuilder<'a> { #[cfg(c_bindings)] pub struct InvoiceWithDerivedSigningPubkeyBuilder<'a> { invreq_bytes: &'a Vec, - invoice: InvoiceContents, + invoice: Box, signing_pubkey_strategy: DerivedSigningPubkey, } @@ -246,8 +246,8 @@ macro_rules! invoice_explicit_signing_pubkey_builder_methods { created_at: Duration, payment_hash: PaymentHash, signing_pubkey: PublicKey, ) -> Result { let amount_msats = Self::amount_msats(invoice_request)?; - let contents = InvoiceContents::ForOffer { - invoice_request: invoice_request.contents.clone(), + let contents = Box::new(InvoiceContents::ForOffer { + invoice_request: *invoice_request.contents.clone(), fields: Self::fields( payment_paths, created_at, @@ -255,7 +255,7 @@ macro_rules! invoice_explicit_signing_pubkey_builder_methods { amount_msats, signing_pubkey, ), - }; + }); Self::new(&invoice_request.bytes, contents, ExplicitSigningPubkey {}) } @@ -266,8 +266,8 @@ macro_rules! invoice_explicit_signing_pubkey_builder_methods { payment_hash: PaymentHash, signing_pubkey: PublicKey, ) -> Result { let amount_msats = refund.amount_msats(); - let contents = InvoiceContents::ForRefund { - refund: refund.contents.clone(), + let contents = Box::new(InvoiceContents::ForRefund { + refund: *refund.contents.clone(), fields: Self::fields( payment_paths, created_at, @@ -275,7 +275,7 @@ macro_rules! invoice_explicit_signing_pubkey_builder_methods { amount_msats, signing_pubkey, ), - }; + }); Self::new(&refund.bytes, contents, ExplicitSigningPubkey {}) } @@ -319,8 +319,8 @@ macro_rules! invoice_derived_signing_pubkey_builder_methods { ) -> Result { let amount_msats = Self::amount_msats(invoice_request)?; let signing_pubkey = keys.public_key(); - let contents = InvoiceContents::ForOffer { - invoice_request: invoice_request.contents.clone(), + let contents = Box::new(InvoiceContents::ForOffer { + invoice_request: *invoice_request.contents.clone(), fields: Self::fields( payment_paths, created_at, @@ -328,7 +328,7 @@ macro_rules! invoice_derived_signing_pubkey_builder_methods { amount_msats, signing_pubkey, ), - }; + }); Self::new(&invoice_request.bytes, contents, DerivedSigningPubkey(keys)) } @@ -340,8 +340,8 @@ macro_rules! invoice_derived_signing_pubkey_builder_methods { ) -> Result { let amount_msats = refund.amount_msats(); let signing_pubkey = keys.public_key(); - let contents = InvoiceContents::ForRefund { - refund: refund.contents.clone(), + let contents = Box::new(InvoiceContents::ForRefund { + refund: *refund.contents.clone(), fields: Self::fields( payment_paths, created_at, @@ -349,7 +349,7 @@ macro_rules! invoice_derived_signing_pubkey_builder_methods { amount_msats, signing_pubkey, ), - }; + }); Self::new(&refund.bytes, contents, DerivedSigningPubkey(keys)) } @@ -429,7 +429,7 @@ macro_rules! invoice_builder_methods { #[cfg_attr(c_bindings, allow(dead_code))] fn new( - invreq_bytes: &'a Vec, contents: InvoiceContents, + invreq_bytes: &'a Vec, contents: Box, signing_pubkey_strategy: $type_param, ) -> Result { if contents.fields().payment_paths.is_empty() { @@ -593,7 +593,7 @@ impl<'a> From> pub struct UnsignedBolt12Invoice { bytes: Vec, experimental_bytes: Vec, - contents: InvoiceContents, + contents: Box, tagged_hash: TaggedHash, } @@ -622,7 +622,7 @@ where } impl UnsignedBolt12Invoice { - fn new(invreq_bytes: &[u8], contents: InvoiceContents) -> Self { + fn new(invreq_bytes: &[u8], contents: Box) -> Self { // TLV record ranges applicable to invreq_bytes. const NON_EXPERIMENTAL_TYPES: core::ops::Range = 0..INVOICE_REQUEST_TYPES.end; const EXPERIMENTAL_TYPES: core::ops::Range = @@ -731,7 +731,7 @@ impl AsRef for UnsignedBolt12Invoice { #[derive(Clone, Debug)] pub struct Bolt12Invoice { bytes: Vec, - contents: InvoiceContents, + contents: Box, signature: Signature, tagged_hash: TaggedHash, } @@ -974,7 +974,7 @@ impl Bolt12Invoice { pub fn verify_using_metadata( &self, key: &ExpandedKey, secp_ctx: &Secp256k1, ) -> Result { - let (metadata, iv_bytes) = match &self.contents { + let (metadata, iv_bytes) = match &*self.contents { InvoiceContents::ForOffer { invoice_request, .. } => { (&invoice_request.inner.payer.0, INVOICE_REQUEST_IV_BYTES) }, @@ -992,7 +992,7 @@ impl Bolt12Invoice { &self, payment_id: PaymentId, nonce: Nonce, key: &ExpandedKey, secp_ctx: &Secp256k1, ) -> Result { let metadata = Metadata::payer_data(payment_id, nonce, key); - let iv_bytes = match &self.contents { + let iv_bytes = match &*self.contents { InvoiceContents::ForOffer { .. } => INVOICE_REQUEST_IV_BYTES, InvoiceContents::ForRefund { .. } => REFUND_IV_BYTES_WITHOUT_METADATA, }; @@ -1027,7 +1027,7 @@ impl Bolt12Invoice { } pub(crate) fn is_for_refund_without_paths(&self) -> bool { - match self.contents { + match &*self.contents { InvoiceContents::ForOffer { .. } => false, InvoiceContents::ForRefund { .. } => self.message_paths().is_empty(), } @@ -1422,7 +1422,7 @@ impl TryFrom> for UnsignedBolt12Invoice { fn try_from(bytes: Vec) -> Result { let invoice = ParsedMessage::::try_from(bytes)?; let ParsedMessage { mut bytes, tlv_stream } = invoice; - let contents = InvoiceContents::try_from(tlv_stream)?; + let contents = Box::new(InvoiceContents::try_from(tlv_stream)?); let tagged_hash = TaggedHash::from_valid_tlv_stream_bytes(SIGNATURE_TAG, &bytes); @@ -1606,7 +1606,7 @@ impl TryFrom> for Bolt12Invoice { experimental_invoice_request_tlv_stream, experimental_invoice_tlv_stream, ) = tlv_stream; - let contents = InvoiceContents::try_from(( + let contents = Box::new(InvoiceContents::try_from(( payer_tlv_stream, offer_tlv_stream, invoice_request_tlv_stream, @@ -1614,7 +1614,7 @@ impl TryFrom> for Bolt12Invoice { experimental_offer_tlv_stream, experimental_invoice_request_tlv_stream, experimental_invoice_tlv_stream, - ))?; + ))?); let signature = signature .ok_or(Bolt12ParseError::InvalidSemantics(Bolt12SemanticError::MissingSignature))?; diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs index 2e399738bae..fe0befa93f7 100644 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@ -119,7 +119,7 @@ pub(super) const IV_BYTES: &[u8; IV_LEN] = b"LDK Invreq ~~~~~"; /// [module-level documentation]: self pub struct InvoiceRequestBuilder<'a, 'b, T: secp256k1::Signing> { offer: &'a Offer, - invoice_request: InvoiceRequestContentsWithoutPayerSigningPubkey, + invoice_request: Box, payer_signing_pubkey: Option, secp_ctx: Option<&'b Secp256k1>, } @@ -132,7 +132,7 @@ pub struct InvoiceRequestBuilder<'a, 'b, T: secp256k1::Signing> { #[cfg(c_bindings)] pub struct InvoiceRequestWithDerivedPayerSigningPubkeyBuilder<'a, 'b> { offer: &'a Offer, - invoice_request: InvoiceRequestContentsWithoutPayerSigningPubkey, + invoice_request: Box, payer_signing_pubkey: Option, secp_ctx: Option<&'b Secp256k1>, } @@ -151,7 +151,7 @@ macro_rules! invoice_request_derived_payer_signing_pubkey_builder_methods { let metadata = Metadata::DerivedSigningPubkey(derivation_material); Self { offer, - invoice_request: Self::create_contents(offer, metadata), + invoice_request: Box::new(Self::create_contents(offer, metadata)), payer_signing_pubkey: None, secp_ctx: Some(secp_ctx), } @@ -181,7 +181,7 @@ macro_rules! invoice_request_builder_methods { ( ) => { #[cfg_attr(c_bindings, allow(dead_code))] fn create_contents(offer: &Offer, metadata: Metadata) -> InvoiceRequestContentsWithoutPayerSigningPubkey { - let offer = offer.contents.clone(); + let offer = *offer.contents.clone(); InvoiceRequestContentsWithoutPayerSigningPubkey { payer: PayerContents(metadata), offer, chain: None, amount_msats: None, features: InvoiceRequestFeatures::empty(), quantity: None, payer_note: None, @@ -317,13 +317,13 @@ macro_rules! invoice_request_builder_methods { ( debug_assert!($self.payer_signing_pubkey.is_some()); let payer_signing_pubkey = $self.payer_signing_pubkey.unwrap(); - let invoice_request = InvoiceRequestContents { + let invoice_request = Box::new(InvoiceRequestContents { #[cfg(not(c_bindings))] inner: $self.invoice_request, #[cfg(c_bindings)] inner: $self.invoice_request.clone(), payer_signing_pubkey, - }; + }); let unsigned_invoice_request = UnsignedInvoiceRequest::new($self.offer, invoice_request); (unsigned_invoice_request, keys, secp_ctx) @@ -446,7 +446,7 @@ impl<'a, 'b> From> pub struct UnsignedInvoiceRequest { bytes: Vec, experimental_bytes: Vec, - contents: InvoiceRequestContents, + contents: Box, tagged_hash: TaggedHash, } @@ -475,7 +475,7 @@ where } impl UnsignedInvoiceRequest { - fn new(offer: &Offer, contents: InvoiceRequestContents) -> Self { + fn new(offer: &Offer, contents: Box) -> Self { // Use the offer bytes instead of the offer TLV stream as the offer may have contained // unknown TLV records, which are not stored in `OfferContents`. let ( @@ -584,7 +584,7 @@ impl AsRef for UnsignedInvoiceRequest { #[cfg_attr(test, derive(PartialEq))] pub struct InvoiceRequest { pub(super) bytes: Vec, - pub(super) contents: InvoiceRequestContents, + pub(super) contents: Box, signature: Signature, } @@ -621,7 +621,7 @@ pub struct VerifiedInvoiceRequest { #[derive(Clone, Debug)] #[cfg_attr(test, derive(PartialEq))] pub(super) struct InvoiceRequestContents { - pub(super) inner: InvoiceRequestContentsWithoutPayerSigningPubkey, + pub(super) inner: Box, payer_signing_pubkey: PublicKey, } @@ -997,10 +997,8 @@ impl VerifiedInvoiceRequest { /// /// [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer pub fn fields(&self) -> InvoiceRequestFields { - let InvoiceRequestContents { - payer_signing_pubkey, - inner: InvoiceRequestContentsWithoutPayerSigningPubkey { quantity, payer_note, .. }, - } = &self.inner.contents; + let InvoiceRequestContents { payer_signing_pubkey, inner } = &*self.inner.contents; + let InvoiceRequestContentsWithoutPayerSigningPubkey { quantity, payer_note, .. } = &**inner; InvoiceRequestFields { payer_signing_pubkey: *payer_signing_pubkey, @@ -1271,7 +1269,7 @@ impl TryFrom> for UnsignedInvoiceRequest { let invoice_request = ParsedMessage::::try_from(bytes)?; let ParsedMessage { mut bytes, tlv_stream } = invoice_request; - let contents = InvoiceRequestContents::try_from(tlv_stream)?; + let contents = Box::new(InvoiceRequestContents::try_from(tlv_stream)?); let tagged_hash = TaggedHash::from_valid_tlv_stream_bytes(SIGNATURE_TAG, &bytes); let offset = TlvStream::new(&bytes) @@ -1298,13 +1296,13 @@ impl TryFrom> for InvoiceRequest { experimental_offer_tlv_stream, experimental_invoice_request_tlv_stream, ) = tlv_stream; - let contents = InvoiceRequestContents::try_from(( + let contents = Box::new(InvoiceRequestContents::try_from(( payer_tlv_stream, offer_tlv_stream, invoice_request_tlv_stream, experimental_offer_tlv_stream, experimental_invoice_request_tlv_stream, - ))?; + ))?); let signature = match signature { None => { @@ -1374,7 +1372,7 @@ impl TryFrom for InvoiceRequestContents { } Ok(InvoiceRequestContents { - inner: InvoiceRequestContentsWithoutPayerSigningPubkey { + inner: Box::new(InvoiceRequestContentsWithoutPayerSigningPubkey { payer, offer, chain, @@ -1385,7 +1383,7 @@ impl TryFrom for InvoiceRequestContents { offer_from_hrn, #[cfg(test)] experimental_bar, - }, + }), payer_signing_pubkey, }) } diff --git a/lightning/src/offers/offer.rs b/lightning/src/offers/offer.rs index f84b39f9a4e..494c2299a2a 100644 --- a/lightning/src/offers/offer.rs +++ b/lightning/src/offers/offer.rs @@ -167,7 +167,7 @@ impl Readable for OfferId { /// /// [module-level documentation]: self pub struct OfferBuilder<'a, M: MetadataStrategy, T: secp256k1::Signing> { - offer: OfferContents, + offer: Box, metadata_strategy: core::marker::PhantomData, secp_ctx: Option<&'a Secp256k1>, } @@ -180,7 +180,7 @@ pub struct OfferBuilder<'a, M: MetadataStrategy, T: secp256k1::Signing> { #[cfg(c_bindings)] #[derive(Clone)] pub struct OfferWithExplicitMetadataBuilder<'a> { - offer: OfferContents, + offer: Box, metadata_strategy: core::marker::PhantomData, secp_ctx: Option<&'a Secp256k1>, } @@ -193,7 +193,7 @@ pub struct OfferWithExplicitMetadataBuilder<'a> { #[cfg(c_bindings)] #[derive(Clone)] pub struct OfferWithDerivedMetadataBuilder<'a> { - offer: OfferContents, + offer: Box, metadata_strategy: core::marker::PhantomData, secp_ctx: Option<&'a Secp256k1>, } @@ -235,7 +235,7 @@ macro_rules! offer_explicit_metadata_builder_methods { /// [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder pub fn new(signing_pubkey: PublicKey) -> Self { Self { - offer: OfferContents { + offer: Box::new(OfferContents { chains: None, metadata: None, amount: None, @@ -248,7 +248,7 @@ macro_rules! offer_explicit_metadata_builder_methods { issuer_signing_pubkey: Some(signing_pubkey), #[cfg(test)] experimental_foo: None, - }, + }), metadata_strategy: core::marker::PhantomData, secp_ctx: None, } @@ -289,7 +289,7 @@ macro_rules! offer_derived_metadata_builder_methods { let derivation_material = MetadataMaterial::new(nonce, expanded_key, None); let metadata = Metadata::DerivedSigningPubkey(derivation_material); Self { - offer: OfferContents { + offer: Box::new(OfferContents { chains: None, metadata: Some(metadata), amount: None, @@ -302,7 +302,7 @@ macro_rules! offer_derived_metadata_builder_methods { issuer_signing_pubkey: Some(node_id), #[cfg(test)] experimental_foo: None, - }, + }), metadata_strategy: core::marker::PhantomData, secp_ctx: Some(secp_ctx), } @@ -595,7 +595,7 @@ pub struct Offer { // The serialized offer. Needed when creating an `InvoiceRequest` if the offer contains unknown // fields. pub(super) bytes: Vec, - pub(super) contents: OfferContents, + pub(super) contents: Box, id: OfferId, } @@ -1169,7 +1169,7 @@ impl TryFrom> for Offer { fn try_from(bytes: Vec) -> Result { let offer = ParsedMessage::::try_from(bytes)?; let ParsedMessage { bytes, tlv_stream } = offer; - let contents = OfferContents::try_from(tlv_stream)?; + let contents = Box::new(OfferContents::try_from(tlv_stream)?); let id = OfferId::from_valid_offer_tlv_stream(&bytes); Ok(Offer { bytes, contents, id }) diff --git a/lightning/src/offers/refund.rs b/lightning/src/offers/refund.rs index e38a3522ec8..7e45f3bd866 100644 --- a/lightning/src/offers/refund.rs +++ b/lightning/src/offers/refund.rs @@ -138,7 +138,7 @@ pub(super) const IV_BYTES_WITHOUT_METADATA: &[u8; IV_LEN] = b"LDK Refund v2~~~"; /// /// [module-level documentation]: self pub struct RefundBuilder<'a, T: secp256k1::Signing> { - refund: RefundContents, + refund: Box, secp_ctx: Option<&'a Secp256k1>, } @@ -150,7 +150,7 @@ pub struct RefundBuilder<'a, T: secp256k1::Signing> { #[cfg(c_bindings)] #[derive(Clone)] pub struct RefundMaybeWithDerivedMetadataBuilder<'a> { - refund: RefundContents, + refund: Box, secp_ctx: Option<&'a Secp256k1>, } @@ -178,7 +178,7 @@ macro_rules! refund_explicit_metadata_builder_methods { let metadata = Metadata::Bytes(metadata); Ok(Self { - refund: RefundContents { + refund: Box::new(RefundContents { payer: PayerContents(metadata), description: String::new(), absolute_expiry: None, @@ -194,7 +194,7 @@ macro_rules! refund_explicit_metadata_builder_methods { experimental_foo: None, #[cfg(test)] experimental_bar: None, - }, + }), secp_ctx: None, }) } @@ -233,7 +233,7 @@ macro_rules! refund_builder_methods { ( let derivation_material = MetadataMaterial::new(nonce, expanded_key, payment_id); let metadata = Metadata::DerivedSigningPubkey(derivation_material); Ok(Self { - refund: RefundContents { + refund: Box::new(RefundContents { payer: PayerContents(metadata), description: String::new(), absolute_expiry: None, issuer: None, chain: None, amount_msats, features: InvoiceRequestFeatures::empty(), quantity: None, payer_signing_pubkey: node_id, payer_note: None, paths: None, @@ -241,7 +241,7 @@ macro_rules! refund_builder_methods { ( experimental_foo: None, #[cfg(test)] experimental_bar: None, - }, + }), secp_ctx: Some(secp_ctx), }) } @@ -449,7 +449,7 @@ impl<'a> From> for RefundBuilder<'a, s #[derive(Clone, Debug)] pub struct Refund { pub(super) bytes: Vec, - pub(super) contents: RefundContents, + pub(super) contents: Box, } /// The contents of a [`Refund`], which may be shared with an [`Bolt12Invoice`]. @@ -894,7 +894,7 @@ impl TryFrom> for Refund { fn try_from(bytes: Vec) -> Result { let refund = ParsedMessage::::try_from(bytes)?; let ParsedMessage { bytes, tlv_stream } = refund; - let contents = RefundContents::try_from(tlv_stream)?; + let contents = Box::new(RefundContents::try_from(tlv_stream)?); Ok(Refund { bytes, contents }) } diff --git a/lightning/src/offers/static_invoice.rs b/lightning/src/offers/static_invoice.rs index 08170fda867..f70af6cccc3 100644 --- a/lightning/src/offers/static_invoice.rs +++ b/lightning/src/offers/static_invoice.rs @@ -68,7 +68,7 @@ pub const SIGNATURE_TAG: &'static str = concat!("lightning", "static_invoice", " #[derive(Clone, Debug)] pub struct StaticInvoice { bytes: Vec, - contents: InvoiceContents, + contents: Box, signature: Signature, } @@ -110,7 +110,7 @@ struct InvoiceContents { // TODO: add module-level docs and link here pub struct StaticInvoiceBuilder<'a> { offer_bytes: &'a Vec, - invoice: InvoiceContents, + invoice: Box, keys: Keypair, } @@ -146,8 +146,13 @@ impl<'a> StaticInvoiceBuilder<'a> { return Err(Bolt12SemanticError::InvalidSigningPubkey); } - let invoice = - InvoiceContents::new(offer, payment_paths, message_paths, created_at, signing_pubkey); + let invoice = Box::new(InvoiceContents::new( + offer, + payment_paths, + message_paths, + created_at, + signing_pubkey, + )); Ok(Self { offer_bytes: &offer.bytes, invoice, keys }) } @@ -196,7 +201,7 @@ impl<'a> StaticInvoiceBuilder<'a> { pub struct UnsignedStaticInvoice { bytes: Vec, experimental_bytes: Vec, - contents: InvoiceContents, + contents: Box, tagged_hash: TaggedHash, } @@ -300,7 +305,7 @@ macro_rules! invoice_accessors_signing_pubkey { } } impl UnsignedStaticInvoice { - fn new(offer_bytes: &Vec, contents: InvoiceContents) -> Self { + fn new(offer_bytes: &Vec, contents: Box) -> Self { let (_, invoice_tlv_stream, _, experimental_invoice_tlv_stream) = contents.as_tlv_stream(); const INVOICE_ALLOCATION_SIZE: usize = 1024; @@ -421,7 +426,7 @@ impl InvoiceContents { message_paths: Vec, created_at: Duration, signing_pubkey: PublicKey, ) -> Self { Self { - offer: offer.contents.clone(), + offer: *offer.contents.clone(), payment_paths, message_paths, created_at, @@ -608,12 +613,12 @@ impl TryFrom> for StaticInvoice { experimental_offer_tlv_stream, experimental_invoice_tlv_stream, ) = tlv_stream; - let contents = InvoiceContents::try_from(( + let contents = Box::new(InvoiceContents::try_from(( offer_tlv_stream, invoice_tlv_stream, experimental_offer_tlv_stream, experimental_invoice_tlv_stream, - ))?; + ))?); let signature = match signature { None => { From 4038f144799fad347d6882867cf550531f11ed38 Mon Sep 17 00:00:00 2001 From: Philip Kannegaard Hayes Date: Fri, 16 May 2025 23:59:07 -0700 Subject: [PATCH 2/2] events: box `AnchorDescriptor`. reduce size_of `Event` 1072 -> 720 --- lightning/src/chain/channelmonitor.rs | 4 ++-- lightning/src/events/bump_transaction.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 9d9e3382ffb..f4ff9bb6a02 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -3544,7 +3544,7 @@ impl ChannelMonitorImpl { package_target_feerate_sat_per_1000_weight, commitment_tx, commitment_tx_fee_satoshis, - anchor_descriptor: AnchorDescriptor { + anchor_descriptor: Box::new(AnchorDescriptor { channel_derivation_parameters: ChannelDerivationParameters { keys_id: self.channel_keys_id, value_satoshis: channel_parameters.channel_value_satoshis, @@ -3554,7 +3554,7 @@ impl ChannelMonitorImpl { txid: commitment_txid, vout: anchor_output_idx, }, - }, + }), pending_htlcs: pending_nondust_htlcs, })); }, diff --git a/lightning/src/events/bump_transaction.rs b/lightning/src/events/bump_transaction.rs index 6ecd6075712..b93f85417e3 100644 --- a/lightning/src/events/bump_transaction.rs +++ b/lightning/src/events/bump_transaction.rs @@ -172,7 +172,7 @@ pub enum BumpTransactionEvent { commitment_tx_fee_satoshis: u64, /// The descriptor to sign the anchor input of the anchor transaction constructed as a /// result of consuming this event. - anchor_descriptor: AnchorDescriptor, + anchor_descriptor: Box, /// The set of pending HTLCs on the commitment transaction that need to be resolved once the /// commitment transaction confirms. pending_htlcs: Vec, @@ -1076,14 +1076,14 @@ mod tests { package_target_feerate_sat_per_1000_weight: 868, commitment_tx_fee_satoshis: 930, commitment_tx, - anchor_descriptor: AnchorDescriptor { + anchor_descriptor: Box::new(AnchorDescriptor { channel_derivation_parameters: ChannelDerivationParameters { value_satoshis: 42_000_000, keys_id: [42; 32], transaction_parameters, }, outpoint: OutPoint { txid: Txid::from_byte_array([42; 32]), vout: 0 }, - }, + }), pending_htlcs: Vec::new(), }); }