htlcswitch: fix TestChannelLinkMultiHopInsufficientPayment add additional comment

This commit is contained in:
Olaoluwa Osuntokun 2017-11-10 15:18:36 -08:00
parent a558925978
commit 0dc98d9955
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -757,18 +757,16 @@ func TestUpdateForwardingPolicy(t *testing.T) {
// First, send this 1 BTC payment over the three hops, the payment // First, send this 1 BTC payment over the three hops, the payment
// should succeed, and all balances should be updated accordingly. // should succeed, and all balances should be updated accordingly.
invoice, err := n.makePayment(n.aliceServer, n.carolServer, payResp, err := n.makePayment(n.aliceServer, n.carolServer,
n.bobServer.PubKey(), hops, amountNoFee, htlcAmt, n.bobServer.PubKey(), hops, amountNoFee, htlcAmt,
htlcExpiry).Wait(10 * time.Second) htlcExpiry).Wait(10 * time.Second)
if err != nil { if err != nil {
t.Fatalf("unable to send payment: %v", err) t.Fatalf("unable to send payment: %v", err)
} }
time.Sleep(100 * time.Millisecond)
// Carol's invoice should now be shown as settled as the payment // Carol's invoice should now be shown as settled as the payment
// succeeded. // succeeded.
invoice, err := receiver.registry.LookupInvoice(rhash) invoice, err := n.carolServer.registry.LookupInvoice(payResp)
if err != nil { if err != nil {
t.Fatalf("unable to get invoice: %v", err) t.Fatalf("unable to get invoice: %v", err)
} }
@ -811,7 +809,7 @@ func TestUpdateForwardingPolicy(t *testing.T) {
// in Bob's new fee policy. // in Bob's new fee policy.
_, err = n.makePayment(n.aliceServer, n.carolServer, _, err = n.makePayment(n.aliceServer, n.carolServer,
n.bobServer.PubKey(), hops, amountNoFee, htlcAmt, n.bobServer.PubKey(), hops, amountNoFee, htlcAmt,
htlcExpiry) htlcExpiry).Wait(10 * time.Second)
if err == nil { if err == nil {
t.Fatalf("payment should've been rejected") t.Fatalf("payment should've been rejected")
} }
@ -834,8 +832,8 @@ func TestChannelLinkMultiHopInsufficientPayment(t *testing.T) {
t.Parallel() t.Parallel()
channels, cleanUp, _, err := createClusterChannels( channels, cleanUp, _, err := createClusterChannels(
btcutil.SatoshiPerBitcoin*5, btcutil.SatoshiPerBitcoin*3,
btcutil.SatoshiPerBitcoin*3) btcutil.SatoshiPerBitcoin*5)
if err != nil { if err != nil {
t.Fatalf("unable to create channel: %v", err) t.Fatalf("unable to create channel: %v", err)
} }
@ -853,6 +851,9 @@ func TestChannelLinkMultiHopInsufficientPayment(t *testing.T) {
secondBobBandwidthBefore := n.secondBobChannelLink.Bandwidth() secondBobBandwidthBefore := n.secondBobChannelLink.Bandwidth()
aliceBandwidthBefore := n.aliceChannelLink.Bandwidth() aliceBandwidthBefore := n.aliceChannelLink.Bandwidth()
// We'll attempt to send 4 BTC although the alice-to-bob channel only
// has 3 BTC total capacity. As a result, this payment should be
// rejected.
amount := lnwire.NewMSatFromSatoshis(4 * btcutil.SatoshiPerBitcoin) amount := lnwire.NewMSatFromSatoshis(4 * btcutil.SatoshiPerBitcoin)
htlcAmt, totalTimelock, hops := generateHops(amount, testStartingHeight, htlcAmt, totalTimelock, hops := generateHops(amount, testStartingHeight,
n.firstBobChannelLink, n.carolChannelLink) n.firstBobChannelLink, n.carolChannelLink)