routing: add new TestEmptyRoutesGenerateSphinxPacket test
This commit is contained in:
parent
098cd940e3
commit
c903a9a711
@ -9,14 +9,14 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lightning-onion"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
)
|
||||
|
||||
// defaultNumRoutes is the default value for the maximum number of routes to
|
||||
@ -1941,3 +1941,16 @@ func TestIsStaleEdgePolicy(t *testing.T) {
|
||||
t.Fatalf("router failed to detect fresh edge policy")
|
||||
}
|
||||
}
|
||||
|
||||
// TestEmptyRoutesGenerateSphinxPacket tests that the generateSphinxPacket
|
||||
// function is able to gracefully handle being passed a nil set of hops for the
|
||||
// route by the caller.
|
||||
func TestEmptyRoutesGenerateSphinxPacket(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
emptyRoute := &Route{}
|
||||
_, _, err := generateSphinxPacket(emptyRoute, testHash[:])
|
||||
if err != ErrNoRouteHopsProvided {
|
||||
t.Fatalf("expected empty hops error: instead got: %v", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user