@@ -1009,16 +1009,6 @@ impl ChannelError {
1009
1009
pub(super) fn close(err: String) -> Self {
1010
1010
ChannelError::Close((err.clone(), ClosureReason::ProcessingError { err }))
1011
1011
}
1012
-
1013
- pub(super) fn message(&self) -> &str {
1014
- match self {
1015
- &ChannelError::Ignore(ref e) => &e,
1016
- &ChannelError::Warn(ref e) => &e,
1017
- &ChannelError::WarnAndDisconnect(ref e) => &e,
1018
- &ChannelError::Close((ref e, _)) => &e,
1019
- &ChannelError::SendError(ref e) => &e,
1020
- }
1021
- }
1022
1012
}
1023
1013
1024
1014
pub(super) struct WithChannelContext<'a, L: Deref>
@@ -5536,12 +5526,13 @@ where
5536
5526
5537
5527
let commitment_signed = self.get_initial_commitment_signed(&funding, logger);
5538
5528
let commitment_signed = match commitment_signed {
5539
- Ok(commitment_signed) => commitment_signed,
5540
- Err(e) => {
5529
+ Some(commitment_signed) => commitment_signed,
5530
+ // TODO(splicing): Support async signing
5531
+ None => {
5541
5532
funding.channel_transaction_parameters.funding_outpoint = None;
5542
5533
return Err(msgs::TxAbort {
5543
5534
channel_id: self.channel_id(),
5544
- data: e.message() .to_owned().into_bytes(),
5535
+ data: "Failed to get signature for commitment_signed" .to_owned().into_bytes(),
5545
5536
});
5546
5537
},
5547
5538
};
@@ -5600,7 +5591,7 @@ where
5600
5591
#[rustfmt::skip]
5601
5592
fn get_initial_counterparty_commitment_signature<L: Deref>(
5602
5593
&self, funding: &FundingScope, logger: &L
5603
- ) -> Result <Signature, ChannelError >
5594
+ ) -> Option <Signature>
5604
5595
where
5605
5596
SP::Target: SignerProvider,
5606
5597
L::Target: Logger
@@ -5615,11 +5606,7 @@ where
5615
5606
let channel_parameters = &funding.channel_transaction_parameters;
5616
5607
ecdsa.sign_counterparty_commitment(channel_parameters, &counterparty_initial_commitment_tx, Vec::new(), Vec::new(), &self.secp_ctx)
5617
5608
.map(|(signature, _)| signature)
5618
- .map_err(|()| {
5619
- let msg = "Failed to get signatures for new commitment_signed";
5620
- let reason = ClosureReason::ProcessingError { err: msg.to_owned() };
5621
- ChannelError::Close((msg.to_owned(), reason))
5622
- })
5609
+ .ok()
5623
5610
},
5624
5611
// TODO (taproot|arik)
5625
5612
#[cfg(taproot)]
@@ -5630,38 +5617,35 @@ where
5630
5617
#[rustfmt::skip]
5631
5618
fn get_initial_commitment_signed<L: Deref>(
5632
5619
&mut self, funding: &FundingScope, logger: &L
5633
- ) -> Result <msgs::CommitmentSigned, ChannelError >
5620
+ ) -> Option <msgs::CommitmentSigned>
5634
5621
where
5635
5622
SP::Target: SignerProvider,
5636
5623
L::Target: Logger
5637
5624
{
5638
5625
assert!(matches!(self.channel_state, ChannelState::FundingNegotiated(flags) if flags.is_interactive_signing()));
5639
5626
5640
- let signature = match self.get_initial_counterparty_commitment_signature(funding, logger) {
5641
- Ok(res) => res,
5642
- Err(e) => {
5643
- log_error!(logger, "Got bad signatures: {:?}!", e);
5644
- return Err(e);
5645
- }
5646
- };
5647
-
5648
- log_info!(logger, "Generated commitment_signed for peer for channel {}", &self.channel_id());
5649
-
5650
- Ok(msgs::CommitmentSigned {
5651
- channel_id: self.channel_id,
5652
- htlc_signatures: vec![],
5653
- signature,
5654
- funding_txid: funding.get_funding_txo().map(|funding_txo| funding_txo.txid),
5655
- #[cfg(taproot)]
5656
- partial_signature_with_nonce: None,
5657
- })
5627
+ let signature = self.get_initial_counterparty_commitment_signature(funding, logger);
5628
+ if let Some(signature) = signature {
5629
+ log_info!(logger, "Generated commitment_signed for peer for channel {}", &self.channel_id());
5630
+ Some(msgs::CommitmentSigned {
5631
+ channel_id: self.channel_id,
5632
+ htlc_signatures: vec![],
5633
+ signature,
5634
+ funding_txid: funding.get_funding_txo().map(|funding_txo| funding_txo.txid),
5635
+ #[cfg(taproot)]
5636
+ partial_signature_with_nonce: None,
5637
+ })
5638
+ } else {
5639
+ // TODO(splicing): Support async signing
5640
+ None
5641
+ }
5658
5642
}
5659
5643
5660
5644
#[cfg(all(test))]
5661
5645
pub fn get_initial_counterparty_commitment_signature_for_test<L: Deref>(
5662
5646
&mut self, funding: &mut FundingScope, logger: &L,
5663
5647
counterparty_cur_commitment_point_override: PublicKey,
5664
- ) -> Result <Signature, ChannelError >
5648
+ ) -> Option <Signature>
5665
5649
where
5666
5650
SP::Target: SignerProvider,
5667
5651
L::Target: Logger,
@@ -8814,7 +8798,16 @@ where
8814
8798
// if it has not received tx_signatures for that funding transaction AND
8815
8799
// if next_commitment_number is zero:
8816
8800
// MUST retransmit its commitment_signed for that funding transaction.
8817
- let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger)?;
8801
+ let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger)
8802
+ // TODO(splicing): Support async signing
8803
+ .ok_or_else(|| {
8804
+ let message = "Failed to get signatures for new commitment_signed".to_owned();
8805
+ ChannelError::Close(
8806
+ (
8807
+ message.clone(),
8808
+ ClosureReason::HolderForceClosed { message, broadcasted_latest_txn: Some(false) },
8809
+ )
8810
+ )})?;
8818
8811
Some(msgs::CommitmentUpdate {
8819
8812
commitment_signed: vec![commitment_signed],
8820
8813
update_add_htlcs: vec![],
0 commit comments