@@ -2259,7 +2259,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2259
2259
self.context.holder_signer.as_mut().provide_channel_parameters(&self.context.channel_transaction_parameters);
2260
2260
2261
2261
self.context.assert_no_commitment_advancement(transaction_number, "initial commitment_signed");
2262
- let commitment_signed = self.context_mut() .get_initial_commitment_signed(logger);
2262
+ let commitment_signed = self.context .get_initial_commitment_signed(logger);
2263
2263
let commitment_signed = match commitment_signed {
2264
2264
Ok(commitment_signed) => {
2265
2265
self.context.funding_transaction = Some(signing_session.unsigned_tx.build_unsigned_tx());
@@ -3424,14 +3424,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3424
3424
!self.channel_state.is_pre_funded_state() &&
3425
3425
!matches!(self.channel_state, ChannelState::AwaitingChannelReady(flags) if flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH))
3426
3426
}
3427
- }
3428
3427
3429
- impl<C, F, SP: Deref> ScopedChannelContext<C, F, SP>
3430
- where
3431
- C: Deref<Target = ChannelContext<SP>>,
3432
- F: Deref<Target = FundingScope>,
3433
- SP::Target: SignerProvider,
3434
- {
3435
3428
/// Transaction nomenclature is somewhat confusing here as there are many different cases - a
3436
3429
/// transaction is referred to as "a's transaction" implying that a will be able to broadcast
3437
3430
/// the transaction. Thus, b will generally be sending a signature over such a transaction to
@@ -3602,7 +3595,7 @@ where
3602
3595
// AwaitingRemoteRevokeToRemove or AwaitingRemovedRemoteRevoke) we may have allowed them to
3603
3596
// "violate" their reserve value by couting those against it. Thus, we have to convert
3604
3597
// everything to i64 before subtracting as otherwise we can overflow.
3605
- let value_to_remote_msat: i64 = (self.channel_value_satoshis() * 1000) as i64 - (self.value_to_self_msat as i64) - (remote_htlc_total_msat as i64) - value_to_self_msat_offset;
3598
+ let value_to_remote_msat: i64 = (self.channel_value_satoshis * 1000) as i64 - (self.value_to_self_msat as i64) - (remote_htlc_total_msat as i64) - value_to_self_msat_offset;
3606
3599
assert!(value_to_remote_msat >= 0);
3607
3600
3608
3601
#[cfg(debug_assertions)]
@@ -3680,9 +3673,7 @@ where
3680
3673
outbound_htlc_preimages,
3681
3674
}
3682
3675
}
3683
- }
3684
3676
3685
- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3686
3677
#[inline]
3687
3678
/// Creates a set of keys for build_commitment_transaction to generate a transaction which our
3688
3679
/// counterparty will sign (ie DO NOT send signatures over a transaction created by this to
@@ -4519,14 +4510,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4519
4510
msg_name);
4520
4511
}
4521
4512
}
4522
- }
4523
4513
4524
- impl<C, F, SP: Deref> ScopedChannelContext<C, F, SP>
4525
- where
4526
- C: Deref<Target = ChannelContext<SP>>,
4527
- F: Deref<Target = FundingScope>,
4528
- SP::Target: SignerProvider,
4529
- {
4530
4514
fn get_initial_counterparty_commitment_signature<L: Deref>(
4531
4515
&self, logger: &L
4532
4516
) -> Result<Signature, ChannelError>
@@ -4553,14 +4537,7 @@ where
4553
4537
_ => todo!(),
4554
4538
}
4555
4539
}
4556
- }
4557
4540
4558
- impl<C, F, SP: Deref> ScopedChannelContext<C, F, SP>
4559
- where
4560
- C: DerefMut<Target = ChannelContext<SP>>,
4561
- F: DerefMut<Target = FundingScope>,
4562
- SP::Target: SignerProvider,
4563
- {
4564
4541
fn get_initial_commitment_signed<L: Deref>(
4565
4542
&mut self, logger: &L
4566
4543
) -> Result<msgs::CommitmentSigned, ChannelError>
@@ -5550,8 +5527,7 @@ impl<SP: Deref> FundedChannel<SP> where
5550
5527
5551
5528
let keys = self.context.build_holder_transaction_keys(self.holder_commitment_point.current_point());
5552
5529
5553
- let funding_context = self.context();
5554
- let commitment_stats = funding_context.build_commitment_transaction(self.holder_commitment_point.transaction_number(), &keys, true, false, logger);
5530
+ let commitment_stats = self.context.build_commitment_transaction(self.holder_commitment_point.transaction_number(), &keys, true, false, logger);
5555
5531
let commitment_txid = {
5556
5532
let trusted_tx = commitment_stats.tx.trust();
5557
5533
let bitcoin_tx = trusted_tx.built_transaction();
@@ -6303,8 +6279,7 @@ impl<SP: Deref> FundedChannel<SP> where
6303
6279
let dust_exposure_limiting_feerate = self.context.get_dust_exposure_limiting_feerate(&fee_estimator);
6304
6280
let htlc_stats = self.context.get_pending_htlc_stats(Some(feerate_per_kw), dust_exposure_limiting_feerate);
6305
6281
let keys = self.context.build_holder_transaction_keys(self.holder_commitment_point.current_point());
6306
- let funding_context = self.context();
6307
- let commitment_stats = funding_context.build_commitment_transaction(self.holder_commitment_point.transaction_number(), &keys, true, true, logger);
6282
+ let commitment_stats = self.context.build_commitment_transaction(self.holder_commitment_point.transaction_number(), &keys, true, true, logger);
6308
6283
let buffer_fee_msat = commit_tx_fee_sat(feerate_per_kw, commitment_stats.num_nondust_htlcs + htlc_stats.on_holder_tx_outbound_holding_cell_htlcs_count as usize + CONCURRENT_INBOUND_HTLC_FEE_BUFFER as usize, self.context.get_channel_type()) * 1000;
6309
6284
let holder_balance_msat = commitment_stats.local_balance_msat - htlc_stats.outbound_holding_cell_msat;
6310
6285
if holder_balance_msat < buffer_fee_msat + self.context.counterparty_selected_channel_reserve_satoshis.unwrap() * 1000 {
@@ -6605,7 +6580,7 @@ impl<SP: Deref> FundedChannel<SP> where
6605
6580
}
6606
6581
let funding_signed = if self.context.signer_pending_funding && !self.context.is_outbound() {
6607
6582
let counterparty_keys = self.context.build_remote_transaction_keys();
6608
- let counterparty_initial_commitment_tx = self.context() .build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number + 1, &counterparty_keys, false, false, logger).tx;
6583
+ let counterparty_initial_commitment_tx = self.context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number + 1, &counterparty_keys, false, false, logger).tx;
6609
6584
self.context.get_funding_signed_msg(logger, counterparty_initial_commitment_tx)
6610
6585
} else { None };
6611
6586
// Provide a `channel_ready` message if we need to, but only if we're _not_ still pending
@@ -8531,8 +8506,7 @@ impl<SP: Deref> FundedChannel<SP> where
8531
8506
where L::Target: Logger
8532
8507
{
8533
8508
let counterparty_keys = self.context.build_remote_transaction_keys();
8534
- let funding_context = self.context();
8535
- let commitment_stats = funding_context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, true, logger);
8509
+ let commitment_stats = self.context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, true, logger);
8536
8510
let counterparty_commitment_tx = commitment_stats.tx;
8537
8511
8538
8512
#[cfg(any(test, fuzzing))]
@@ -8564,8 +8538,7 @@ impl<SP: Deref> FundedChannel<SP> where
8564
8538
self.build_commitment_no_state_update(logger);
8565
8539
8566
8540
let counterparty_keys = self.context.build_remote_transaction_keys();
8567
- let funding_context = self.context();
8568
- let commitment_stats = funding_context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, true, logger);
8541
+ let commitment_stats = self.context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, true, logger);
8569
8542
let counterparty_commitment_txid = commitment_stats.tx.trust().txid();
8570
8543
8571
8544
match &self.context.holder_signer {
@@ -8842,7 +8815,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
8842
8815
/// Only allowed after [`ChannelContext::channel_transaction_parameters`] is set.
8843
8816
fn get_funding_created_msg<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
8844
8817
let counterparty_keys = self.context.build_remote_transaction_keys();
8845
- let counterparty_initial_commitment_tx = self.context() .build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, false, logger).tx;
8818
+ let counterparty_initial_commitment_tx = self.context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, false, logger).tx;
8846
8819
let signature = match &self.context.holder_signer {
8847
8820
// TODO (taproot|arik): move match into calling method for Taproot
8848
8821
ChannelSignerType::Ecdsa(ecdsa) => {
0 commit comments