lnrpc+routing: Only accept a single route for SendToRoute

This commit is contained in:
Joost Jager
2018-08-08 11:09:30 +02:00
parent 0b66d56aab
commit ba3fa94268
10 changed files with 693 additions and 736 deletions

View File

@@ -18,6 +18,7 @@ import (
sphinx "github.com/lightningnetwork/lightning-onion"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/zpay32"
@@ -407,12 +408,12 @@ func TestChannelUpdateValidation(t *testing.T) {
// The payment parameter is mostly redundant in SendToRoute. Can be left
// empty for this test.
payment := &LightningPayment{}
var payment lntypes.Hash
// Send off the payment request to the router. The specified route
// should be attempted and the channel update should be received by
// router and ignored because it is missing a valid signature.
_, _, err = ctx.router.SendToRoute([]*route.Route{rt}, payment)
_, err = ctx.router.SendToRoute(payment, rt)
if err == nil {
t.Fatalf("expected route to fail with channel update")
}
@@ -445,7 +446,7 @@ func TestChannelUpdateValidation(t *testing.T) {
}
// Retry the payment using the same route as before.
_, _, err = ctx.router.SendToRoute([]*route.Route{rt}, payment)
_, err = ctx.router.SendToRoute(payment, rt)
if err == nil {
t.Fatalf("expected route to fail with channel update")
}