Skip to content

Commit feb1b67

Browse files
committed
Only generate an Event::DiscardFunding when we need to
5e874c3 changed `Event::DiscardFunding` to not include a dummy transaction when we were funded without a full funding tx, but in doing so started generating `DiscardFunding` events on every channel closure rather than only when there's actually still a pending funding broadcast. This restores the previous behavior to only generate the event when we should actually discard the funding tx.
1 parent 5e874c3 commit feb1b67

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3547,12 +3547,15 @@ where
35473547
channel_funding_txo: shutdown_res.channel_funding_txo,
35483548
}, None));
35493549

3550-
let funding_info = if is_manual_broadcast {
3551-
shutdown_res.channel_funding_txo.map(|outpoint| FundingInfo::OutPoint{ outpoint })
3552-
} else {
3553-
shutdown_res.unbroadcasted_funding_tx.map(|transaction| FundingInfo::Tx{ transaction })
3554-
};
3555-
if let Some(funding_info) = funding_info {
3550+
if let Some(transaction) = shutdown_res.unbroadcasted_funding_tx {
3551+
let funding_info = if is_manual_broadcast {
3552+
FundingInfo::OutPoint {
3553+
outpoint: shutdown_res.channel_funding_txo
3554+
.expect("We had an unbroadcasted funding tx, so should also have had a funding outpoint"),
3555+
}
3556+
} else {
3557+
FundingInfo::Tx{ transaction }
3558+
};
35563559
pending_events.push_back((events::Event::DiscardFunding {
35573560
channel_id: shutdown_res.channel_id, funding_info
35583561
}, None));

0 commit comments

Comments
 (0)