From 932742e1f91313635451bfe420a359c622cb18eb Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 13 Dec 2017 17:09:08 -0800 Subject: [PATCH] lnd_test: use completePaymentRequests in channel force close itest --- lnd_test.go | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index 72787a93..e38f0f13 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -1156,25 +1156,6 @@ func testChannelForceClosure(net *networkHarness, t *harnessTest) { return aliceChannelInfo.Channels[0], nil } - // Open up a payment stream to Alice that we'll use to send payment to - // Carol. We also create a small helper function to send payments to - // Carol, consuming the payment hashes we generated above. - alicePayStream, err := net.Alice.SendPayment(ctxb) - if err != nil { - t.Fatalf("unable to create payment stream for alice: %v", err) - } - sendPayments := func(start, stop int) error { - for i := start; i < stop; i++ { - sendReq := &lnrpc.SendRequest{ - PaymentRequest: carolPaymentReqs[i], - } - if err := alicePayStream.Send(sendReq); err != nil { - return err - } - } - return nil - } - // Fetch starting height of this test so we can compute the block // heights we expect certain events to take place. _, curHeight, err := net.Miner.Node.GetBestBlock() @@ -1194,7 +1175,9 @@ func testChannelForceClosure(net *networkHarness, t *harnessTest) { // Send payments from Alice to Carol, since Carol is htlchodl mode, // the htlc outputs should be left unsettled, and should be swept by the // utxo nursery. - if err := sendPayments(0, numInvoices); err != nil { + ctxt, _ = context.WithTimeout(ctxb, timeout) + err = completePaymentRequests(ctxt, net.Alice, carolPaymentReqs, false) + if err != nil { t.Fatalf("unable to send payment: %v", err) } time.Sleep(200 * time.Millisecond)