routing/pathfind: set final hop features used in pathfinding
In this commit, we overwrite the final hop's features with either the destination features or those loaded from the graph fallback. This ensures that the same features used in pathfinding will be provided to route construction. In an earlier commit, we validated the final hop's transitive feature dependencies, so we also add validation to non-final nodes.
This commit is contained in:
2 files changed
+58
No files matched your search
@@ -1482,6 +1482,21 @@ func TestMissingFeatureDep(t *testing.T) {
|
||||
Features: payAddrFeatures,
|
||||
}, 0,
|
||||
),
|
||||
asymmetricTestChannel("conner", "joost", 100000,
|
||||
&testChannelPolicy{
|
||||
Expiry: 144,
|
||||
FeeRate: 400,
|
||||
MinHTLC: 1,
|
||||
MaxHTLC: 100000000,
|
||||
Features: payAddrFeatures,
|
||||
},
|
||||
&testChannelPolicy{
|
||||
Expiry: 144,
|
||||
FeeRate: 400,
|
||||
MinHTLC: 1,
|
||||
MaxHTLC: 100000000,
|
||||
}, 0,
|
||||
),
|
||||
}
|
||||
|
||||
ctx := newPathFindingTestContext(t, testChannels, "roasbeef")
|
||||
@@ -1530,6 +1545,19 @@ func TestMissingFeatureDep(t *testing.T) {
|
||||
t.Fatalf("path should have been found: %v", err)
|
||||
}
|
||||
assertExpectedPath(t, ctx.testGraphInstance.aliasMap, path, "conner")
|
||||
|
||||
// Finally, try to find a route to joost through conner. The
|
||||
// destination features are set properly from the previous assertions,
|
||||
// but conner's feature vector in the graph is still broken. We expect
|
||||
// errNoPathFound and not the missing feature dep err above since
|
||||
// intermediate hops are simply skipped if they have invalid feature
|
||||
// vectors, leaving no possible route to joost.
|
||||
joost := ctx.testGraphInstance.aliasMap["joost"]
|
||||
|
||||
_, err = find(&restrictions, joost)
|
||||
if err != errNoPathFound {
|
||||
t.Fatalf("path shouldn't have been found: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestDestPaymentAddr asserts that we properly detect when we can send a
|
||||
|
||||
Reference in new issue
Block a user