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

Conversation

TheBlueMatt
Copy link
Collaborator

No description provided.

@TheBlueMatt TheBlueMatt added this to the 0.0.124 milestone Aug 27, 2024
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.
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.03%. Comparing base (5e62df7) to head (ea646ae).
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3275      +/-   ##
==========================================
+ Coverage   89.82%   90.03%   +0.20%     
==========================================
  Files         126      126              
  Lines      103024   104472    +1448     
  Branches   103024   104472    +1448     
==========================================
+ Hits        92543    94058    +1515     
+ Misses       7769     7753      -16     
+ Partials     2712     2661      -51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

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.

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

In 5e874c3 we'd intended to not
reveal the dummy funding transaction in `Event::DiscardFunding`.
However, instead of looking at the channel that was just closed,
the logic only looks at any other channels which were funded as a
part of the same batch. Because manually-funded transactions
cannot currently be done for batch funding, this was actually dead
code, preventing the new changes from taking effect.
Comment on lines +3461 to +3462
/// Note that if [`Self::is_manual_broadcast`] is true the transaction will be a dummy
/// transaction.
Copy link
Contributor

@jkczyz jkczyz Aug 28, 2024

Choose a reason for hiding this comment

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

Could we have used an enum indicating the manual case? Or does that affect the serialization logic / format?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could swap this, yea. We didn't bother in the initial PR cause we forgot about this issue until it was basically ready.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also this method is only actually used in batch funding, which never has a non-transaction, so...

@TheBlueMatt TheBlueMatt merged commit bf6a53e into lightningdevkit:main Aug 29, 2024
17 of 19 checks passed
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.

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

@@ -936,6 +936,7 @@ pub(crate) struct ShutdownResult {
pub(crate) user_channel_id: u128,
pub(crate) channel_capacity_satoshis: u64,
pub(crate) counterparty_node_id: PublicKey,
pub(crate) is_manual_broadcast: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

I though of doing it but I choose the monkey way of doing it by iterating over all the channels, thanks for catching it

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

Post merge review, LGTM.

Thanks for catching the bug that I introduced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants