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

invoiecs: fix value conversion bug in AddHodlInvoice #198

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

Roasbeef
Copy link
Member

Before this commit, callers wouldn't be able to use an msat amount as input to the hold invoice RPC call. Instead, the wrapper logic would always convert to msat first, causing a loss in precision. For most cases, sat amounts are fine, but some use cases require higher precision.

We fix this by keeping the input value in mSat (as typed), while using the ValueMsat field as lnd would expect.

Pull Request Checklist

  • PR is opened against correct version branch.
  • Version compatibility matrix in the README and minimal required version
    in lnd_services.go are updated.
  • Update macaroon_recipes.go if your PR adds a new method that is called
    differently than the RPC method it invokes.

Before this commit, callers wouldn't be able to use an msat amount as
input to the hold invoice RPC call. Instead, the wrapper logic would
always convert to msat first, causing a loss in precision. For most
cases, sat amounts are fine, but some use cases require higher
precision.

We fix this by keeping the input value in mSat (as typed), while using
the `ValueMsat` field as `lnd` would expect.
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

Nice catch! LGTM 💯

Copy link
Member

@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.

Nice fix! LGTM 🎉

@guggero guggero merged commit b0499bb into lightninglabs:lnd-18-4 Oct 25, 2024
1 check passed
@guggero
Copy link
Member

guggero commented Oct 25, 2024

I'm also going to cherry pick that comment onto the master branch, since it's a useful fix there too.

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.

3 participants