Skip to content

Commit ddf2296

Browse files
committed
ln: box AnchorDescriptor in BumpTransactionEvent to reduce sizeof Event
Reduces `mem::size_of::<Event>()` from 1072 B -> 576 B
1 parent af915cf commit ddf2296

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3544,7 +3544,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
35443544
package_target_feerate_sat_per_1000_weight,
35453545
commitment_tx,
35463546
commitment_tx_fee_satoshis,
3547-
anchor_descriptor: AnchorDescriptor {
3547+
anchor_descriptor: Box::new(AnchorDescriptor {
35483548
channel_derivation_parameters: ChannelDerivationParameters {
35493549
keys_id: self.channel_keys_id,
35503550
value_satoshis: channel_parameters.channel_value_satoshis,
@@ -3554,7 +3554,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
35543554
txid: commitment_txid,
35553555
vout: anchor_output_idx,
35563556
},
3557-
},
3557+
}),
35583558
pending_htlcs: pending_nondust_htlcs,
35593559
}));
35603560
},

lightning/src/events/bump_transaction.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub enum BumpTransactionEvent {
167167
commitment_tx_fee_satoshis: u64,
168168
/// The descriptor to sign the anchor input of the anchor transaction constructed as a
169169
/// result of consuming this event.
170-
anchor_descriptor: AnchorDescriptor,
170+
anchor_descriptor: Box<AnchorDescriptor>,
171171
/// The set of pending HTLCs on the commitment transaction that need to be resolved once the
172172
/// commitment transaction confirms.
173173
pending_htlcs: Vec<HTLCOutputInCommitment>,
@@ -955,14 +955,14 @@ mod tests {
955955
package_target_feerate_sat_per_1000_weight: 868,
956956
commitment_tx_fee_satoshis: 930,
957957
commitment_tx,
958-
anchor_descriptor: AnchorDescriptor {
958+
anchor_descriptor: Box::new(AnchorDescriptor {
959959
channel_derivation_parameters: ChannelDerivationParameters {
960960
value_satoshis: 42_000_000,
961961
keys_id: [42; 32],
962962
transaction_parameters,
963963
},
964964
outpoint: OutPoint { txid: Txid::from_byte_array([42; 32]), vout: 0 },
965-
},
965+
}),
966966
pending_htlcs: Vec::new(),
967967
});
968968
}

0 commit comments

Comments
 (0)