- 
                Notifications
    You must be signed in to change notification settings 
- Fork 137
bugfix: fix btc-only balance force close, fix incorrect policy in invoice hop hint #1601
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
Conversation
This commit addresses an edge case where one party only has a BTC balance (but no asset balance). In that case the balance is allowed to be below the dust limit. But because those sats will be added to the fee and can't be materialized on-chain, we also can't create an allocation for the balance. Otherwise we'll have a mismatch between the number of allocations and the number of expected on-chain outputs of the transaction. This isn't an issue when there is an asset balance, as in that case we enforce that the BTC balance is above the dust limit.
Due to (probably) a copy/paste error, we returned the wrong policy for an invoice. We didn't notice this because in our integration tests we never set non-default routing policies.
| Pull Request Test Coverage Report for Build 15682067785Details
 
 
 
 💛 - Coveralls | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice LGTM!
We could consider introducing distinct types for inbound and outbound policies to prevent misuse—e.g., accidentally passing an outbound policy where an inbound one is expected. That said, probably not something for this PR.
Also, do we need any regression tests (changes to tests) to cover this fix?
| 
 Yeah, that would be nice. But that would require changes in lnd and its RPC. 
 Yes, I've added them in the linked litd PR: lightninglabs/lightning-terminal#1089 | 
| 
 @guggero I was thinking of just wrapper types in tap. | 
| 
 Ah, okay. But we currently only use the policies in a single place, so not sure if that's a bit overkill for now. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎯
| // peer in the channel. | ||
| policy := edge.Node2Policy | ||
| if edge.Node2Pub == remotePubStr { | ||
| if edge.Node1Pub == remotePubStr { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, the direction of the policy here is relative
Fixes root cause of #1595.
Also fixes #1598.
Corresponding integration tests can be found here: lightninglabs/lightning-terminal#1089