mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-09 20:33:45 +01:00
lnrpc+routing: Only accept a single route for SendToRoute
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user