Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow-ups to PR 3137 #3423

Merged
merged 7 commits into from
Feb 27, 2025
18 changes: 15 additions & 3 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2242,15 +2242,19 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
},
};

let funding_ready_for_sig_event = None;
if signing_session.local_inputs_count() == 0 {
let funding_ready_for_sig_event = if signing_session.local_inputs_count() == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funding_ready_for_sig_event is always None, though it was already too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it only makes sense for contributions. So will happen next.

debug_assert_eq!(our_funding_satoshis, 0);
if signing_session.provide_holder_witnesses(self.context.channel_id, Vec::new()).is_err() {
debug_assert!(
false,
"Zero inputs were provided & zero witnesses were provided, but a count mismatch was somehow found",
);
return Err((self, ChannelError::Close((
"V2 channel rejected due to sender error".into(),
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) }
))));
}
None
} else {
// TODO(dual_funding): Send event for signing if we've contributed funds.
// Inform the user that SIGHASH_ALL must be used for all signatures when contributing
Expand All @@ -2266,7 +2270,15 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
// will prevent the funding transaction from being relayed on the bitcoin network and hence being
// confirmed.
// </div>
}
debug_assert!(
false,
"We don't support users providing inputs but somehow we had more than zero inputs",
);
return Err((self, ChannelError::Close((
"V2 channel rejected due to sender error".into(),
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) }
))));
};

self.context.channel_state = ChannelState::FundingNegotiated;

Expand Down