channeldb/migration_01_to_11: isolate route structure

Before we change the Hop struct, isolate the code that is used in older
migrations to prevent breaking them.

route.go was taken from commit 6e463c1634
This commit is contained in:
Joost Jager committed 2019-12-12 00:12:17 +01:00
1 parent 62dadff291
commit 7aa4a7c7fc
6 files changed
+362 -37

No files matched your search

@@ -16,7 +16,6 @@ import (
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
)
// TestPaymentStatusesMigration checks that already completed payments will have
@@ -714,25 +713,25 @@ func makeRandPaymentCreationInfo() (*PaymentCreationInfo, error) {
func TestPaymentRouteSerialization(t *testing.T) {
t.Parallel()
legacyHop1 := &route.Hop{
PubKeyBytes: route.NewVertex(pub),
legacyHop1 := &Hop{
PubKeyBytes: NewVertex(pub),
ChannelID: 12345,
OutgoingTimeLock: 111,
LegacyPayload: true,
AmtToForward: 555,
}
legacyHop2 := &route.Hop{
PubKeyBytes: route.NewVertex(pub),
legacyHop2 := &Hop{
PubKeyBytes: NewVertex(pub),
ChannelID: 12345,
OutgoingTimeLock: 111,
LegacyPayload: true,
AmtToForward: 555,
}
legacyRoute := route.Route{
legacyRoute := Route{
TotalTimeLock: 123,
TotalAmount: 1234567,
SourcePubKey: route.NewVertex(pub),
Hops: []*route.Hop{legacyHop1, legacyHop2},
SourcePubKey: NewVertex(pub),
Hops: []*Hop{legacyHop1, legacyHop2},
}
const numPayments = 4