htlcswitch/test: convert TestChannelLinkSingleHopPayment to two hop network
This commit is contained in:
parent
037913fd28
commit
af7d0e5ff5
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user