Skip to content

#3259 followups #3275

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

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3547,12 +3547,15 @@ where
channel_funding_txo: shutdown_res.channel_funding_txo,
}, None));

let funding_info = if is_manual_broadcast {
shutdown_res.channel_funding_txo.map(|outpoint| FundingInfo::OutPoint{ outpoint })
} else {
shutdown_res.unbroadcasted_funding_tx.map(|transaction| FundingInfo::Tx{ transaction })
};
if let Some(funding_info) = funding_info {
if let Some(transaction) = shutdown_res.unbroadcasted_funding_tx {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be easy to add test coverage for the bug described in the commit message (maybe in follow-up)? Seems obvious in retrospect, ugh.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Errr, yea, good thing I did that....the whole logic was broken.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pre-existing, but I think it would be useful to have some docs on unbroadcasted_funding_tx. Because I assumed it would always be None for unsafe_manual_broadcast'd channels, but that would mean we would never hit the manual broadcast clause below so that doesn't make sense..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, we added some to Channel::funding_transaction, but not the method.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okay, I see the docs now

Copy link
Contributor

Choose a reason for hiding this comment

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

ops this is my fault, sorry that I did not thing about this!

let funding_info = if is_manual_broadcast {
FundingInfo::OutPoint {
outpoint: shutdown_res.channel_funding_txo
.expect("We had an unbroadcasted funding tx, so should also have had a funding outpoint"),
}
} else {
FundingInfo::Tx{ transaction }
};
pending_events.push_back((events::Event::DiscardFunding {
channel_id: shutdown_res.channel_id, funding_info
}, None));
Expand Down