routing: extend path finding to be TLV-EOB aware, allow dest TLV records

In this commit, we extend the path finding to be able to recognize when
a node needs the new TLV format, or the legacy format based on the
feature bits they expose. We also extend the `LightningPayment` struct
to allow the caller to specify an arbitrary set of TLV records which can
be used for a number of use-cases including various variants of
spontaneous payments.
This commit is contained in:
Olaoluwa Osuntokun
2019-07-30 21:41:58 -07:00
parent 5b4c8ac232
commit 4697cfde30
9 changed files with 158 additions and 50 deletions

View File

@@ -11,6 +11,7 @@ import (
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/routing/route"
@@ -26,6 +27,7 @@ var (
ChannelID: 12345,
OutgoingTimeLock: 111,
AmtToForward: 555,
LegacyPayload: true,
}
testRoute = route.Route{
@@ -144,7 +146,9 @@ func TestControlTowerSubscribeSuccess(t *testing.T) {
}
if !reflect.DeepEqual(result.Route, &attempt.Route) {
t.Fatal("unexpected route")
t.Fatalf("unexpected route: %v vs %v",
spew.Sdump(result.Route),
spew.Sdump(attempt.Route))
}
// After the final event, we expect the channel to be closed.