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]: GetChanInfo returns an error for zero-conf channels #7229

Open
alexbosworth opened this issue Dec 3, 2022 · 10 comments · Fixed by #7292
Open

[bug]: GetChanInfo returns an error for zero-conf channels #7229

alexbosworth opened this issue Dec 3, 2022 · 10 comments · Fixed by #7292
Assignees
Labels

Comments

@alexbosworth
Copy link
Contributor

Background

To update channel fees, you can use the UpdateChannelPolicy and then use GetChanInfo to confirm the fee rate update was applied, but for zero-conf channels the latter API call returns an error

So when looking up such a channel with GetChanInfo, it should return the channel info

Your environment

  • LND 0.15.5-beta

Steps to reproduce

  • Create a zero-conf channel
  • Update the fee rate
  • Check that the fee rate was applied

Expected behavior

  • The fee rate should be returned

Actual behavior

  • Error is returned
@alexbosworth alexbosworth added bug Unintended code behaviour needs triage labels Dec 3, 2022
@yyforyongyu
Copy link
Member

What's the returned error?

@positiveblue positiveblue self-assigned this Dec 5, 2022
@alexbosworth
Copy link
Contributor Author

edge not found

@Crypt-iQ
Copy link
Collaborator

Crypt-iQ commented Dec 6, 2022

Is the zero-conf channel confirmed? Which SCID are you using in the call to GetChanInfo?

@alexbosworth
Copy link
Contributor Author

it is not confirmed

@Crypt-iQ
Copy link
Collaborator

I wasn't able to reproduce this following the steps above. The channel was an unconfirmed, zero-conf channel and GetChanInfo returned the expected info

@alexbosworth
Copy link
Contributor Author

ok cool, must be due to using the wrong id then

@Crypt-iQ
Copy link
Collaborator

Crypt-iQ commented Jan 5, 2023

This happened due to a disconnected block notification which called

lnd/channeldb/graph.go

Lines 1519 to 1533 in d9c79d8

func (c *ChannelGraph) DisconnectBlockAtHeight(height uint32) ([]*ChannelEdgeInfo,
error) {
// Every channel having a ShortChannelID starting at 'height'
// will no longer be confirmed.
startShortChanID := lnwire.ShortChannelID{
BlockHeight: height,
}
// Delete everything after this height from the db.
endShortChanID := lnwire.ShortChannelID{
BlockHeight: math.MaxUint32 & 0x00ffffff,
TxIndex: math.MaxUint32 & 0x00ffffff,
TxPosition: math.MaxUint16,
}

This leads to every SCID in the graph being deleted if it has a height after the disconnected height - meaning every zero-conf channel gets its edge deleted. The fix here would be set endShortChanID to right before the start of the alias SCID range. I'm not sure what can be done to remedy this if this has happened to live zero-conf channels without trying to close the channel or trying to surgically insert the edge

@Roasbeef
Copy link
Member

Roasbeef commented Jan 5, 2023

I'm not sure what can be done to remedy this if this has happened to live zero-conf channels without trying to close the channel or trying to surgically insert the edge

Can pass in an interface to skip if an scid alias is ours and "looks" like something we'd make?

@Crypt-iQ
Copy link
Collaborator

Crypt-iQ commented Jan 5, 2023

Can pass in an interface to skip if an scid alias is ours and "looks" like something we'd make?

I meant that if this has already happened to a node, the edge wouldn't exist and I wasn't sure how to fix that after-the-fact without possibly closing the channel

@saubyk saubyk added this to the v0.16.0 milestone Jan 6, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in lnd v0.16.0 Jan 6, 2023
@saubyk saubyk moved this from 🆕 New to 🏗 In progress in lnd v0.16.0 Jan 6, 2023
@saubyk saubyk assigned Crypt-iQ and unassigned positiveblue Jan 12, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in lnd v0.16.0 Jan 26, 2023
@Roasbeef
Copy link
Member

Re-opening this as it still seems to be popping up. Got a report of a main gateway node not having the channel update (?), so it can't send the latest one to leaf nodes, who are now making invalid invoices, causing incoming payments to fail.

This has been a very long standing issue. One recovery method could be just re-generating if we don't have it for some reason, but the bigger question is why it's getting "lost" in transit.

@Roasbeef Roasbeef reopened this May 16, 2023
@github-project-automation github-project-automation bot moved this from ✅ Done to 📋 Backlog in lnd v0.16.0 May 16, 2023
@Roasbeef Roasbeef modified the milestones: v0.16.0, v0.17.0 May 17, 2023
@saubyk saubyk modified the milestones: v0.17.0, v0.16.0 Aug 4, 2023
@saubyk saubyk removed this from the v0.16.0 milestone Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

6 participants