Skip to content

Commit 66ecc40

Browse files
committed
f - only emit SpliceFailed when initiator
1 parent dea4e85 commit 66ecc40

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
@@ -1909,30 +1909,32 @@ where
19091909
.and_then(|pending_splice| pending_splice.funding_negotiation.take());
19101910

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

1926-
SpliceFundingFailed {
1927-
channel_id: funded_channel.context.channel_id,
1928-
counterparty_node_id: funded_channel.context.counterparty_node_id,
1929-
user_channel_id: funded_channel.context.user_id,
1930-
funding_txo,
1931-
channel_type,
1932-
contributed_inputs: Vec::new(),
1933-
contributed_outputs: Vec::new(),
1934-
}
1935-
});
1928+
SpliceFundingFailed {
1929+
channel_id: funded_channel.context.channel_id,
1930+
counterparty_node_id: funded_channel.context.counterparty_node_id,
1931+
user_channel_id: funded_channel.context.user_id,
1932+
funding_txo,
1933+
channel_type,
1934+
contributed_inputs: Vec::new(),
1935+
contributed_outputs: Vec::new(),
1936+
}
1937+
});
19361938
(should_ack, splice_funding_failed)
19371939
},
19381940
};

0 commit comments

Comments
 (0)