From af7d0e5ff5587812b779bf64ec8493213a65bd48 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Fri, 5 Apr 2019 10:29:56 +0200 Subject: [PATCH] htlcswitch/test: convert TestChannelLinkSingleHopPayment to two hop network --- htlcswitch/link_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 4d8143fa..950a5ddf 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -179,7 +179,8 @@ func createInterceptorFunc(prefix, receiver string, messages []expectedMessage, func TestChannelLinkSingleHopPayment(t *testing.T) { t.Parallel() - channels, cleanUp, _, err := createClusterChannels( + // Setup a alice-bob network. + aliceChannel, bobChannel, cleanUp, err := createTwoClusterChannels( btcutil.SatoshiPerBitcoin*3, btcutil.SatoshiPerBitcoin*5) if err != nil { @@ -187,15 +188,14 @@ func TestChannelLinkSingleHopPayment(t *testing.T) { } defer cleanUp() - n := newThreeHopNetwork(t, channels.aliceToBob, channels.bobToAlice, - channels.bobToCarol, channels.carolToBob, testStartingHeight) + n := newTwoHopNetwork(t, aliceChannel, bobChannel, testStartingHeight) if err := n.start(); err != nil { t.Fatal(err) } defer n.stop() aliceBandwidthBefore := n.aliceChannelLink.Bandwidth() - bobBandwidthBefore := n.firstBobChannelLink.Bandwidth() + bobBandwidthBefore := n.bobChannelLink.Bandwidth() debug := false if debug { @@ -205,12 +205,12 @@ func TestChannelLinkSingleHopPayment(t *testing.T) { // Log message that bob receives. n.bobServer.intersect(createLogFunc("bob", - n.firstBobChannelLink.ChanID())) + n.bobChannelLink.ChanID())) } amount := lnwire.NewMSatFromSatoshis(btcutil.SatoshiPerBitcoin) htlcAmt, totalTimelock, hops := generateHops(amount, testStartingHeight, - n.firstBobChannelLink) + n.bobChannelLink) // Wait for: // * HTLC add request to be sent to bob. @@ -219,7 +219,7 @@ func TestChannelLinkSingleHopPayment(t *testing.T) { // * alice<->bob commitment state to be updated. // * user notification to be sent. receiver := n.bobServer - firstHop := n.firstBobChannelLink.ShortChanID() + firstHop := n.bobChannelLink.ShortChanID() rhash, err := makePayment( n.aliceServer, receiver, firstHop, hops, amount, htlcAmt, totalTimelock, @@ -248,10 +248,10 @@ func TestChannelLinkSingleHopPayment(t *testing.T) { "amount") } - if bobBandwidthBefore+amount != n.firstBobChannelLink.Bandwidth() { + if bobBandwidthBefore+amount != n.bobChannelLink.Bandwidth() { t.Fatalf("bob bandwidth isn't match: expected %v, got %v", bobBandwidthBefore+amount, - n.firstBobChannelLink.Bandwidth()) + n.bobChannelLink.Bandwidth()) } }