Skip to content

discovery: properly set FirstBlockHeight and NumBlocks in responses#3785

Merged
Roasbeef merged 1 commit intolightningnetwork:masterfrom
Roasbeef:gossip-queries-fix
Dec 11, 2019
Merged

discovery: properly set FirstBlockHeight and NumBlocks in responses#3785
Roasbeef merged 1 commit intolightningnetwork:masterfrom
Roasbeef:gossip-queries-fix

Conversation

@Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Dec 3, 2019

In this commit we fix in a bug in lnd that could cause other
implementations which implement a strict version of the spec to
disconnect when trying to sync their channel graph using the gossip
query feature. Before this commit, we would embed the request to a
QueryChannelRange in the response, causing some clients to reject the
response as the FirstBlockHeight and NumBlocks field would be
identical for each chunk of the response.

In order to remedy this, we now properly set these two fields with each
returned chunk. Note that even after this commit, we keep our existing
behavior surrounding the Complete field as is. Otherwise, current
lnd clients which rely on this field (rather than the two
aforementioned fields) wouldn't be able to properly detect when a set of
responses to their query was "complete".

Partially fixes #3728.

@halseth halseth requested review from bhandras and removed request for halseth December 3, 2019 13:03
Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

Changes LGTM, haven't tested in the wild yet.

Linter is failing with:

discovery/syncer_test.go:722: File is not `gofmt`-ed with `-s` (gofmt)
		lnwire.ShortChannelID{

Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

LGTM 🍣

@cfromknecht
Copy link
Contributor

@Roasbeef needs squash!

@cfromknecht cfromknecht added this to the 0.9.0 milestone Dec 10, 2019
In this commit we fix in a bug in `lnd` that could cause other
implementations which implement a strict version of the spec to
disconnect when trying to sync their channel graph using the gossip
query feature. Before this commit, we would embed the request to a
`QueryChannelRange` in the response, causing some clients to reject the
response as the `FirstBlockHeight` and `NumBlocks` field would be
identical for each chunk of the response.

In order to remedy this, we now properly set these two fields with each
returned chunk. Note that even after this commit, we keep our existing
behavior surrounding the `Complete` field as is. Otherwise, current
`lnd` clients which rely on this field (rather than the two
aforementioned fields) wouldn't be able to properly detect when a set of
responses to their query was "complete".

Partially fixes lightningnetwork#3728.
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.

LND mis-implements gossip_queries

4 participants