Skip to content

Commit c34c042

Browse files
authored
Merge pull request #8874 from ellemouton/assumeTLV2
routing: remove left over TLV feature bit checks
2 parents ce81327 + 3ceb7d5 commit c34c042

File tree

3 files changed

+5
-62
lines changed

3 files changed

+5
-62
lines changed

docs/release-notes/release-notes-0.18.2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,5 @@
9595
* Bufo
9696
* Elle Mouton
9797
* Matheus Degiovani
98+
* Oliver Gugger
9899
* Slyghtning

routing/pathfind.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -543,34 +543,16 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
543543
return nil, 0, errMissingDependentFeature
544544
}
545545

546-
// Now that we know the feature vector is well formed, we'll proceed in
547-
// checking that it supports the features we need, given our
548-
// restrictions on the final hop.
549-
550-
// If the caller needs to send custom records, check that our
551-
// destination feature vector supports TLV.
552-
if len(r.DestCustomRecords) > 0 &&
553-
!features.HasFeature(lnwire.TLVOnionPayloadOptional) {
554-
555-
return nil, 0, errNoTlvPayload
556-
}
557-
558-
// If the caller has a payment address to attach, check that our
559-
// destination feature vector supports them.
546+
// Now that we know the feature vector is well-formed, we'll proceed in
547+
// checking that it supports the features we need. If the caller has a
548+
// payment address to attach, check that our destination feature vector
549+
// supports them.
560550
if r.PaymentAddr != nil &&
561551
!features.HasFeature(lnwire.PaymentAddrOptional) {
562552

563553
return nil, 0, errNoPaymentAddr
564554
}
565555

566-
// If the caller needs to send custom records, check that our
567-
// destination feature vector supports TLV.
568-
if r.Metadata != nil &&
569-
!features.HasFeature(lnwire.TLVOnionPayloadOptional) {
570-
571-
return nil, 0, errNoTlvPayload
572-
}
573-
574556
// Set up outgoing channel map for quicker access.
575557
var outgoingChanMap map[uint64]struct{}
576558
if len(r.OutgoingChannelIDs) > 0 {

routing/pathfind_test.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -882,13 +882,6 @@ func runFindPathWithMetadata(t *testing.T, useCache bool) {
882882

883883
_, err = ctx.findPath(target, paymentAmt)
884884
require.ErrorIs(t, errNoPathFound, err)
885-
886-
// Assert that tlv payload support takes precedence over metadata
887-
// issues.
888-
ctx.restrictParams.DestFeatures = lnwire.EmptyFeatureVector()
889-
890-
_, err = ctx.findPath(target, paymentAmt)
891-
require.ErrorIs(t, errNoTlvPayload, err)
892885
}
893886

894887
// runFindLowestFeePath tests that out of two routes with identical total
@@ -1261,20 +1254,6 @@ func runPathFindingWithAdditionalEdges(t *testing.T, useCache bool) {
12611254
restrictions := *noRestrictions
12621255
restrictions.DestCustomRecords = record.CustomSet{70000: []byte{}}
12631256

1264-
_, err = find(&restrictions)
1265-
if err != errNoTlvPayload {
1266-
t.Fatalf("path shouldn't have been found: %v", err)
1267-
}
1268-
1269-
// Set empty dest features so we don't try the fallback. We should still
1270-
// fail since the tlv feature isn't set.
1271-
restrictions.DestFeatures = lnwire.EmptyFeatureVector()
1272-
1273-
_, err = find(&restrictions)
1274-
if err != errNoTlvPayload {
1275-
t.Fatalf("path shouldn't have been found: %v", err)
1276-
}
1277-
12781257
// Finally, set the tlv feature in the payload and assert we found the
12791258
// same path as before.
12801259
restrictions.DestFeatures = tlvFeatures
@@ -1775,31 +1754,12 @@ func runDestTLVGraphFallback(t *testing.T, useCache bool) {
17751754
// Add custom records w/o any dest features.
17761755
restrictions.DestCustomRecords = record.CustomSet{70000: []byte{}}
17771756

1778-
// Path to luoji should fail because his node ann features are empty.
1779-
_, err = find(&restrictions, luoji)
1780-
if err != errNoTlvPayload {
1781-
t.Fatalf("path shouldn't have been found: %v", err)
1782-
}
1783-
17841757
// However, path to satoshi should succeed via the fallback because his
17851758
// node ann features have the TLV bit.
17861759
path, err := find(&restrictions, satoshi)
17871760
require.NoError(t, err, "path should have been found")
17881761
assertExpectedPath(t, ctx.testGraphInstance.aliasMap, path, "satoshi")
17891762

1790-
// Add empty destination features. This should cause both paths to fail,
1791-
// since this override anything in the graph.
1792-
restrictions.DestFeatures = lnwire.EmptyFeatureVector()
1793-
1794-
_, err = find(&restrictions, luoji)
1795-
if err != errNoTlvPayload {
1796-
t.Fatalf("path shouldn't have been found: %v", err)
1797-
}
1798-
_, err = find(&restrictions, satoshi)
1799-
if err != errNoTlvPayload {
1800-
t.Fatalf("path shouldn't have been found: %v", err)
1801-
}
1802-
18031763
// Finally, set the TLV dest feature. We should succeed in finding a
18041764
// path to luoji.
18051765
restrictions.DestFeatures = tlvFeatures

0 commit comments

Comments
 (0)