Skip to content

Commit f67fdad

Browse files
committed
f - only emit SpliceFailed when initiator
1 parent 10aeb60 commit f67fdad

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

lightning/src/ln/channel.rs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,30 +1913,32 @@ where
19131913
.and_then(|pending_splice| pending_splice.funding_negotiation.take());
19141914

19151915
let should_ack = funding_negotiation_opt.is_some();
1916-
let splice_funding_failed = funding_negotiation_opt.map(|funding_negotiation| {
1917-
// Create SpliceFundingFailed for the aborted splice
1918-
let (funding_txo, channel_type) = match &funding_negotiation {
1919-
FundingNegotiation::ConstructingTransaction { funding, .. } => {
1920-
(funding.get_funding_txo().map(|txo| txo.into_bitcoin_outpoint()), Some(funding.get_channel_type().clone()))
1921-
},
1922-
FundingNegotiation::AwaitingSignatures { funding } => {
1923-
(funding.get_funding_txo().map(|txo| txo.into_bitcoin_outpoint()), Some(funding.get_channel_type().clone()))
1924-
},
1925-
FundingNegotiation::AwaitingAck { .. } => {
1926-
(None, None)
1927-
},
1928-
};
1916+
let splice_funding_failed = funding_negotiation_opt
1917+
.filter(|funding_negotiation| funding_negotiation.is_initiator())
1918+
.map(|funding_negotiation| {
1919+
// Create SpliceFundingFailed for the aborted splice
1920+
let (funding_txo, channel_type) = match &funding_negotiation {
1921+
FundingNegotiation::ConstructingTransaction { funding, .. } => {
1922+
(funding.get_funding_txo().map(|txo| txo.into_bitcoin_outpoint()), Some(funding.get_channel_type().clone()))
1923+
},
1924+
FundingNegotiation::AwaitingSignatures { funding, .. } => {
1925+
(funding.get_funding_txo().map(|txo| txo.into_bitcoin_outpoint()), Some(funding.get_channel_type().clone()))
1926+
},
1927+
FundingNegotiation::AwaitingAck { .. } => {
1928+
(None, None)
1929+
},
1930+
};
19291931

1930-
SpliceFundingFailed {
1931-
channel_id: funded_channel.context.channel_id,
1932-
counterparty_node_id: funded_channel.context.counterparty_node_id,
1933-
user_channel_id: funded_channel.context.user_id,
1934-
funding_txo,
1935-
channel_type,
1936-
contributed_inputs: Vec::new(),
1937-
contributed_outputs: Vec::new(),
1938-
}
1939-
});
1932+
SpliceFundingFailed {
1933+
channel_id: funded_channel.context.channel_id,
1934+
counterparty_node_id: funded_channel.context.counterparty_node_id,
1935+
user_channel_id: funded_channel.context.user_id,
1936+
funding_txo,
1937+
channel_type,
1938+
contributed_inputs: Vec::new(),
1939+
contributed_outputs: Vec::new(),
1940+
}
1941+
});
19401942
(should_ack, splice_funding_failed)
19411943
},
19421944
};

0 commit comments

Comments
 (0)