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

[bug]: Always add local channels to the GraphCache even though Policies is disabled #9465

Open
ziggie1984 opened this issue Jan 31, 2025 · 4 comments
Assignees
Labels
bug Unintended code behaviour graph payments Related to invoices/payments

Comments

@ziggie1984
Copy link
Collaborator

Happened to a node operator, had a channel with a node which is basically a wallet (is always offline except when receiving or sending money) it happened that both channel policies for this channel where disabled and now the channel will not be added to our GraphCache and hence becomes unusable. I therefore highly suggest always adding our local channels to the GraphCache:

Relevant code:

lnd/graph/db/graph_cache.go

Lines 167 to 171 in f4bf99b

if policy1 != nil && policy1.IsDisabled() &&
policy2 != nil && policy2.IsDisabled() {
return
}

@ziggie1984 ziggie1984 added bug Unintended code behaviour graph payments Related to invoices/payments labels Jan 31, 2025
@starius
Copy link
Collaborator

starius commented Jan 31, 2025

An additional bug discovered in lncli:

lncli updatechanstatus xxx enable
[lncli] unable to decode output index: strconv.ParseUint: parsing "enable": invalid syntax

According to lncli updatechanstatus --help such format should work though:

USAGE:
   lncli updatechanstatus [command options] funding_txid [output_index] action

@ziggie1984
Copy link
Collaborator Author

ziggie1984 commented Jan 31, 2025

So to give more background so the issue is more clear:

The operator had a channel which had both policies (disabled=true, not sure why both sides). He was seeing this channel as active tho, because as soon as the peer cam online the channel was fully functional. However he could not send funds to this direct peer and the logs didn't reveal anything because in our payment logic we call the graph to get information about our local channels and the channel would not be part of it:

if the user specified the outgoing_chan_id the logging said insufficient funds and failed here:

max, total, err := getOutgoingBalance(

if outgoing constraint was specified it failed by never considering the channel:

https://github.com/lightningnetwork/lnd/blob/f4bf99b1611b8daeca5f66ff95a537d28790e175/routing/pathfind.go#L1038C3-L1039

@ziggie1984
Copy link
Collaborator Author

Moreover when one of the channel policies is enabled, the channel is not added to the cache, so this should also be take into account when fixing this issue.

@starius
Copy link
Collaborator

starius commented Feb 3, 2025

If the graph cache is disabled via --db.no-graph-cache option, the payment succeeds.
This looks as a bug to me. Cache should optimize accesses, not affect results.

@starius starius assigned starius and unassigned ellemouton Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended code behaviour graph payments Related to invoices/payments
Projects
None yet
Development

No branches or pull requests

3 participants