@@ -4187,8 +4187,14 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4187
4187
to_countersignatory_value,
4188
4188
) | {
4189
4189
let nondust_htlcs = vec ! [ ] ;
4190
+ // Since we're expected to only reach here during the initial persistence of a
4191
+ // monitor (i.e., via [`Persist::persist_new_channel`]), we expect to only have
4192
+ // one `FundingScope` present.
4193
+ debug_assert ! ( self . pending_funding. is_empty( ) ) ;
4194
+ let channel_parameters = & self . funding . channel_parameters ;
4190
4195
4191
4196
let commitment_tx = self . build_counterparty_commitment_tx (
4197
+ channel_parameters,
4192
4198
INITIAL_COMMITMENT_NUMBER ,
4193
4199
& their_per_commitment_point,
4194
4200
to_broadcaster_value,
@@ -4206,11 +4212,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4206
4212
4207
4213
#[ rustfmt:: skip]
4208
4214
fn build_counterparty_commitment_tx (
4209
- & self , commitment_number : u64 , their_per_commitment_point : & PublicKey ,
4210
- to_broadcaster_value : u64 , to_countersignatory_value : u64 , feerate_per_kw : u32 ,
4215
+ & self , channel_parameters : & ChannelTransactionParameters , commitment_number : u64 ,
4216
+ their_per_commitment_point : & PublicKey , to_broadcaster_value : u64 ,
4217
+ to_countersignatory_value : u64 , feerate_per_kw : u32 ,
4211
4218
nondust_htlcs : Vec < HTLCOutputInCommitment >
4212
4219
) -> CommitmentTransaction {
4213
- let channel_parameters = & self . funding . channel_parameters . as_counterparty_broadcastable ( ) ;
4220
+ let channel_parameters = & channel_parameters. as_counterparty_broadcastable ( ) ;
4214
4221
CommitmentTransaction :: new ( commitment_number, their_per_commitment_point,
4215
4222
to_broadcaster_value, to_countersignatory_value, feerate_per_kw, nondust_htlcs, channel_parameters, & self . onchain_tx_handler . secp_ctx )
4216
4223
}
@@ -4232,9 +4239,20 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4232
4239
htlc. transaction_output_index . map ( |_| htlc) . cloned ( )
4233
4240
} ) . collect :: < Vec < _ > > ( ) ;
4234
4241
4235
- let commitment_tx = self . build_counterparty_commitment_tx ( commitment_number,
4236
- & their_per_commitment_point, to_broadcaster_value,
4237
- to_countersignatory_value, feerate_per_kw, nondust_htlcs) ;
4242
+ // This monitor update variant is only applicable while there's a single
4243
+ // `FundingScope` active, otherwise we expect to see
4244
+ // `LatestCounterpartyCommitment` instead.
4245
+ debug_assert ! ( self . pending_funding. is_empty( ) ) ;
4246
+ let channel_parameters = & self . funding . channel_parameters ;
4247
+ let commitment_tx = self . build_counterparty_commitment_tx (
4248
+ channel_parameters,
4249
+ commitment_number,
4250
+ & their_per_commitment_point,
4251
+ to_broadcaster_value,
4252
+ to_countersignatory_value,
4253
+ feerate_per_kw,
4254
+ nondust_htlcs,
4255
+ ) ;
4238
4256
4239
4257
debug_assert_eq ! ( commitment_tx. trust( ) . txid( ) , commitment_txid) ;
4240
4258
0 commit comments