Skip to content

Commit 4151b97

Browse files
committed
Detect splice out as local contribution
Although a splice out doesn't include inputs to sign, users still need to call back with `funding_transaction_signed` to sign the shared splice input.
1 parent dc57d94 commit 4151b97

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9034,8 +9034,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
90349034
.and_then(|_| channel.interactive_tx_signing_session.as_mut())
90359035
.filter(|signing_session| signing_session.holder_tx_signatures().is_none())
90369036
{
9037-
let local_inputs_count = signing_session.local_inputs_count();
9038-
if local_inputs_count > 0 {
9037+
if signing_session.has_local_contribution() {
90399038
let mut pending_events = self.pending_events.lock().unwrap();
90409039
let unsigned_transaction = signing_session.unsigned_tx().build_unsigned_tx();
90419040
let event_action = (

lightning/src/ln/interactivetxs.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,24 @@ impl InteractiveTxSigningSession {
561561
.count()
562562
}
563563

564+
fn local_outputs_count(&self) -> usize {
565+
self.unsigned_tx
566+
.outputs
567+
.iter()
568+
.enumerate()
569+
.filter(|(_, output)| {
570+
!is_serial_id_valid_for_counterparty(
571+
self.unsigned_tx.holder_is_initiator,
572+
output.serial_id,
573+
)
574+
})
575+
.count()
576+
}
577+
578+
pub fn has_local_contribution(&self) -> bool {
579+
self.local_inputs_count() > 0 || self.local_outputs_count() > 0
580+
}
581+
564582
pub fn shared_input(&self) -> Option<&NegotiatedTxInput> {
565583
self.unsigned_tx
566584
.shared_input_index

0 commit comments

Comments
 (0)