Skip to content

routing: ignore unknown required features in pathfinding#3893

Merged
cfromknecht merged 5 commits into
lightningnetwork:masterfrom
cfromknecht:pathfind-ignore-required-features
Jan 8, 2020
Merged

routing: ignore unknown required features in pathfinding#3893
cfromknecht merged 5 commits into
lightningnetwork:masterfrom
cfromknecht:pathfind-ignore-required-features

Conversation

@cfromknecht
Copy link
Copy Markdown
Contributor

@cfromknecht cfromknecht commented Jan 8, 2020

This PR brings us inline with recent modifications to the spec, that
say we shouldn't pay nodes whose feature vectors signal unknown required
features, and also that we shouldn't route through nodes signaling
unknown required features.

Currently we assert that invoices don't have such features during
decoding, but now that users can specify feature vectors via the rpc
interface, it makes sense to perform this check deeper in call stack.
This will also allow us to remove the check from decoding entirely,
making decodepayreq more useful for debugging.

We also fix one of the test vectors which had been incorrectly copied
from lightning/bolts#719.
Feature bit 9 was missing from the current encoding, which is caught
now that we consider the decoding valid and actually perform the
comparison with the expected struct.

Comment thread routing/pathfind.go Outdated
Comment thread routing/pathfind_test.go Outdated
@cfromknecht cfromknecht force-pushed the pathfind-ignore-required-features branch 2 times, most recently from 321a1f7 to 80690d0 Compare January 8, 2020 11:49
Copy link
Copy Markdown
Contributor

@halseth halseth 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 cfromknecht requested a review from joostjager January 8, 2020 11:52
Comment thread routing/pathfind_test.go Outdated
@cfromknecht cfromknecht force-pushed the pathfind-ignore-required-features branch from 80690d0 to dd1b2be Compare January 8, 2020 20:22
This wraps the raw UnknownRequiredFeatures method and returns a proper
error type to enable more exact testing.
This commit brings us inline with recent modifications to the spec, that
say we shouldn't pay nodes whose feature vectors signal unknown required
features, and also that we shouldn't route through nodes signaling
unknown required features.

Currently we assert that invoices don't have such features during
decoding, but now that users can specify feature vectors via the rpc
interface, it makes sense to perform this check deeper in call stack.
This will also allow us to remove the check from decoding entirely,
making decodepayreq more useful for debugging.
This commit removes the unknown required feature bit check from the
invoice decoding logic. This allows greater utility to users of the
decodepayreq rpc since it can provide inspection of otherwise invalid
invoices. In the prior commit, this check moved into our path finding
logic, so invalid features taken from an invoice will instead cause a
failure when attempting to pay.
This allows us to remove the custom error type originally implemented
for this purpose.
@cfromknecht cfromknecht force-pushed the pathfind-ignore-required-features branch from dd1b2be to 2510ec0 Compare January 8, 2020 20:26
@cfromknecht cfromknecht merged commit 6c8c99d into lightningnetwork:master Jan 8, 2020
@cfromknecht cfromknecht deleted the pathfind-ignore-required-features branch January 8, 2020 22:13
@cfromknecht cfromknecht added this to the 0.9.0 milestone Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants