diff --git a/itest/lnd_quiescence_test.go b/itest/lnd_quiescence_test.go index d782228a8..a00c00189 100644 --- a/itest/lnd_quiescence_test.go +++ b/itest/lnd_quiescence_test.go @@ -13,9 +13,6 @@ import ( // testQuiescence tests whether we can come to agreement on quiescence of a // channel. We initiate quiescence via RPC and if it succeeds we verify that // the expected initiator is the resulting initiator. -// -// NOTE FOR REVIEW: this could be improved by blasting the channel with HTLC -// traffic on both sides to increase the surface area of the change under test. func testQuiescence(ht *lntest.HarnessTest) { cfg := node.CfgAnchor chanPoints, nodes := ht.CreateSimpleNetwork( @@ -26,25 +23,41 @@ func testQuiescence(ht *lntest.HarnessTest) { alice, bob := nodes[0], nodes[1] chanPoint := chanPoints[0] + // Bob adds an invoice. + payAmt := btcutil.Amount(100000) + invReq := &lnrpc.Invoice{ + Value: int64(payAmt), + } + invoice1 := bob.RPC.AddInvoice(invReq) + + // Before quiescence, Alice should be able to send HTLCs. + req := &routerrpc.SendPaymentRequest{ + PaymentRequest: invoice1.PaymentRequest, + FeeLimitMsat: noFeeLimitMsat, + } + ht.SendPaymentAssertSettled(alice, req) + + // Alice now requires the channel to be quiescent. Once it's done, she + // will not be able to send payments. res := alice.RPC.Quiesce(&devrpc.QuiescenceRequest{ ChanId: chanPoint, }) - require.True(ht, res.Initiator) - req := &routerrpc.SendPaymentRequest{ - Dest: alice.PubKey[:], - Amt: 100, - PaymentHash: ht.Random32Bytes(), - FinalCltvDelta: finalCltvDelta, + // Bob adds another invoice. + invoice2 := bob.RPC.AddInvoice(invReq) + + // Alice now tries to pay the second invoice. + // + // This fails with insufficient balance because the bandwidth manager + // reports 0 bandwidth if a link is not eligible for forwarding, which + // is the case during quiescence. + req = &routerrpc.SendPaymentRequest{ + PaymentRequest: invoice2.PaymentRequest, FeeLimitMsat: noFeeLimitMsat, } - ht.SendPaymentAssertFail( - bob, req, - // This fails with insufficient balance because the bandwidth - // manager reports 0 bandwidth if a link is not eligible for - // forwarding, which is the case during quiescence. + alice, req, lnrpc.PaymentFailureReason_FAILURE_REASON_INSUFFICIENT_BALANCE, ) }