@@ -4195,8 +4195,14 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4195
4195
to_countersignatory_value,
4196
4196
) | {
4197
4197
let nondust_htlcs = vec ! [ ] ;
4198
+ // Since we're expected to only reach here during the initial persistence of a
4199
+ // monitor (i.e., via [`Persist::persist_new_channel`]), we expect to only have
4200
+ // one `FundingScope` present.
4201
+ debug_assert ! ( self . pending_funding. is_empty( ) ) ;
4202
+ let channel_parameters = & self . funding . channel_parameters ;
4198
4203
4199
4204
let commitment_tx = self . build_counterparty_commitment_tx (
4205
+ channel_parameters,
4200
4206
INITIAL_COMMITMENT_NUMBER ,
4201
4207
& their_per_commitment_point,
4202
4208
to_broadcaster_value,
@@ -4214,11 +4220,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4214
4220
4215
4221
#[ rustfmt:: skip]
4216
4222
fn build_counterparty_commitment_tx (
4217
- & self , commitment_number : u64 , their_per_commitment_point : & PublicKey ,
4218
- to_broadcaster_value : u64 , to_countersignatory_value : u64 , feerate_per_kw : u32 ,
4223
+ & self , channel_parameters : & ChannelTransactionParameters , commitment_number : u64 ,
4224
+ their_per_commitment_point : & PublicKey , to_broadcaster_value : u64 ,
4225
+ to_countersignatory_value : u64 , feerate_per_kw : u32 ,
4219
4226
nondust_htlcs : Vec < HTLCOutputInCommitment >
4220
4227
) -> CommitmentTransaction {
4221
- let channel_parameters = & self . funding . channel_parameters . as_counterparty_broadcastable ( ) ;
4228
+ let channel_parameters = & channel_parameters. as_counterparty_broadcastable ( ) ;
4222
4229
CommitmentTransaction :: new ( commitment_number, their_per_commitment_point,
4223
4230
to_broadcaster_value, to_countersignatory_value, feerate_per_kw, nondust_htlcs, channel_parameters, & self . onchain_tx_handler . secp_ctx )
4224
4231
}
@@ -4240,9 +4247,20 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4240
4247
htlc. transaction_output_index . map ( |_| htlc) . cloned ( )
4241
4248
} ) . collect :: < Vec < _ > > ( ) ;
4242
4249
4243
- let commitment_tx = self . build_counterparty_commitment_tx ( commitment_number,
4244
- & their_per_commitment_point, to_broadcaster_value,
4245
- to_countersignatory_value, feerate_per_kw, nondust_htlcs) ;
4250
+ // This monitor update variant is only applicable while there's a single
4251
+ // `FundingScope` active, otherwise we expect to see
4252
+ // `LatestCounterpartyCommitment` instead.
4253
+ debug_assert ! ( self . pending_funding. is_empty( ) ) ;
4254
+ let channel_parameters = & self . funding . channel_parameters ;
4255
+ let commitment_tx = self . build_counterparty_commitment_tx (
4256
+ channel_parameters,
4257
+ commitment_number,
4258
+ & their_per_commitment_point,
4259
+ to_broadcaster_value,
4260
+ to_countersignatory_value,
4261
+ feerate_per_kw,
4262
+ nondust_htlcs,
4263
+ ) ;
4246
4264
4247
4265
debug_assert_eq ! ( commitment_tx. trust( ) . txid( ) , commitment_txid) ;
4248
4266
0 commit comments