@@ -2965,10 +2965,15 @@ where
2965
2965
self.context.assert_no_commitment_advancement(transaction_number, "initial commitment_signed");
2966
2966
let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger);
2967
2967
let commitment_signed = match commitment_signed {
2968
- Ok (commitment_signed) => commitment_signed,
2969
- Err(err) => {
2968
+ Some (commitment_signed) => commitment_signed,
2969
+ None => {
2970
2970
self.funding.channel_transaction_parameters.funding_outpoint = None;
2971
- return Err(ChannelError::Close((err.to_string(), ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) })));
2971
+ return Err(ChannelError::Close(
2972
+ (
2973
+ "Failed to get signatures for new commitment_signed".to_owned(),
2974
+ ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
2975
+ )
2976
+ ));
2972
2977
},
2973
2978
};
2974
2979
@@ -5494,7 +5499,7 @@ where
5494
5499
#[rustfmt::skip]
5495
5500
fn get_initial_counterparty_commitment_signature<L: Deref>(
5496
5501
&self, funding: &FundingScope, logger: &L
5497
- ) -> Result <Signature, ChannelError >
5502
+ ) -> Option <Signature>
5498
5503
where
5499
5504
SP::Target: SignerProvider,
5500
5505
L::Target: Logger
@@ -5509,11 +5514,7 @@ where
5509
5514
let channel_parameters = &funding.channel_transaction_parameters;
5510
5515
ecdsa.sign_counterparty_commitment(channel_parameters, &counterparty_initial_commitment_tx, Vec::new(), Vec::new(), &self.secp_ctx)
5511
5516
.map(|(signature, _)| signature)
5512
- .map_err(|_| ChannelError::Close(
5513
- (
5514
- "Failed to get signatures for new commitment_signed".to_owned(),
5515
- ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
5516
- )))
5517
+ .ok()
5517
5518
},
5518
5519
// TODO (taproot|arik)
5519
5520
#[cfg(taproot)]
@@ -5524,38 +5525,35 @@ where
5524
5525
#[rustfmt::skip]
5525
5526
fn get_initial_commitment_signed<L: Deref>(
5526
5527
&mut self, funding: &FundingScope, logger: &L
5527
- ) -> Result <msgs::CommitmentSigned, ChannelError >
5528
+ ) -> Option <msgs::CommitmentSigned>
5528
5529
where
5529
5530
SP::Target: SignerProvider,
5530
5531
L::Target: Logger
5531
5532
{
5532
5533
assert!(matches!(self.channel_state, ChannelState::FundingNegotiated(_)));
5533
5534
5534
- let signature = match self.get_initial_counterparty_commitment_signature(funding, logger) {
5535
- Ok(res) => res,
5536
- Err(e) => {
5537
- log_error!(logger, "Got bad signatures: {:?}!", e);
5538
- return Err(e);
5539
- }
5540
- };
5541
-
5542
- log_info!(logger, "Generated commitment_signed for peer for channel {}", &self.channel_id());
5543
-
5544
- Ok(msgs::CommitmentSigned {
5545
- channel_id: self.channel_id,
5546
- htlc_signatures: vec![],
5547
- signature,
5548
- funding_txid: funding.get_funding_txo().map(|funding_txo| funding_txo.txid),
5549
- #[cfg(taproot)]
5550
- partial_signature_with_nonce: None,
5551
- })
5535
+ let signature = self.get_initial_counterparty_commitment_signature(funding, logger);
5536
+ if let Some(signature) = signature {
5537
+ log_info!(logger, "Generated commitment_signed for peer for channel {}", &self.channel_id());
5538
+ Some(msgs::CommitmentSigned {
5539
+ channel_id: self.channel_id,
5540
+ htlc_signatures: vec![],
5541
+ signature,
5542
+ funding_txid: funding.get_funding_txo().map(|funding_txo| funding_txo.txid),
5543
+ #[cfg(taproot)]
5544
+ partial_signature_with_nonce: None,
5545
+ })
5546
+ } else {
5547
+ // TODO: Support async signing
5548
+ None
5549
+ }
5552
5550
}
5553
5551
5554
5552
#[cfg(all(test))]
5555
5553
pub fn get_initial_counterparty_commitment_signature_for_test<L: Deref>(
5556
5554
&mut self, funding: &mut FundingScope, logger: &L,
5557
5555
counterparty_cur_commitment_point_override: PublicKey,
5558
- ) -> Result <Signature, ChannelError >
5556
+ ) -> Option <Signature>
5559
5557
where
5560
5558
SP::Target: SignerProvider,
5561
5559
L::Target: Logger,
@@ -8426,7 +8424,14 @@ where
8426
8424
// if it has not received tx_signatures for that funding transaction AND
8427
8425
// if next_commitment_number is zero:
8428
8426
// MUST retransmit its commitment_signed for that funding transaction.
8429
- let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger)?;
8427
+ let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger)
8428
+ // TODO Support async signing
8429
+ .ok_or_else(|| ChannelError::Close(
8430
+ (
8431
+ "Failed to get signatures for new commitment_signed".to_owned(),
8432
+ ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
8433
+ )
8434
+ ))?;
8430
8435
Some(msgs::CommitmentUpdate {
8431
8436
commitment_signed: vec![commitment_signed],
8432
8437
update_add_htlcs: vec![],
0 commit comments