Skip to content
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

lnwallet+rpcserver: fix weight calculation for taproot channels #8037

Merged
merged 2 commits into from Sep 28, 2023

Conversation

yyforyongyu
Copy link
Collaborator

@yyforyongyu yyforyongyu commented Sep 27, 2023

Fix the weight calculation found in multiple places.

Fix #8036

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix!

lnwallet/channel.go Show resolved Hide resolved
rpcserver.go Show resolved Hide resolved
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Very nice! Can confirm the itest catches the issue that is fixed in the PR. LGTM 🎉

itest/lnd_payment_test.go Show resolved Hide resolved
Adds a new test to check direct payments between two nodes. The fee rate
is tuned to 1 sat/vb to catch edge cases.
@Roasbeef
Copy link
Member

To answer the question above re why this results in a lower fee rate in the sanity check instead of a higher one:

  • We use the correct weight values everywhere else up to this point, so we estimate against a "fully loaded" commitment tx (witness, etc).
  • When we get down to this check, we actually over estimate the weight since we use the segwit v0 witness value. For the musig2 channels, the witness is ~4x smaller, so by using the old constant we over estimate the weight for the sanity check, which leads to a lower fee rate.

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 👙

@Roasbeef Roasbeef merged commit bb7a257 into lightningnetwork:master Sep 28, 2023
24 of 25 checks passed
@yyforyongyu yyforyongyu deleted the fix-weight-calc branch September 28, 2023 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: 0-conf Simple Taproot channel becomes inactive after payment is made
3 participants