From 2d446b3b9eeda6dabe6956deee9bfbe16d9d6814 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 11 Jun 2026 14:57:04 -0500 Subject: [PATCH] test: remove unused PayInvoice mock path Loop no longer pays invoices through LightningClient.PayInvoice. Production payment paths use the router client wrappers. lndclient now also implements PayInvoice on top of router payment APIs, so the old SendPaymentChannel mock path is no longer exercised. Remove the dead PayInvoice mock, its SendPaymentChannel plumbing, and the loop-in resume assertion that watched that channel. --- loopin_test.go | 6 ------ test/lightning_client_mock.go | 15 --------------- test/lnd_services_mock.go | 14 -------------- 3 files changed, 35 deletions(-) diff --git a/loopin_test.go b/loopin_test.go index a1a09584..15a11e32 100644 --- a/loopin_test.go +++ b/loopin_test.go @@ -655,12 +655,6 @@ func testLoopInResume(t *testing.T, state loopdb.SwapState, expired bool, defer func() { require.NoError(t, <-errChan) - select { - case <-ctx.lnd.SendPaymentChannel: - t.Fatal("unexpected payment sent") - default: - } - select { case <-ctx.lnd.SendOutputsChannel: t.Fatal("unexpected tx published") diff --git a/test/lightning_client_mock.go b/test/lightning_client_mock.go index fe4198a1..9a9b9047 100644 --- a/test/lightning_client_mock.go +++ b/test/lightning_client_mock.go @@ -29,21 +29,6 @@ type mockLightningClient struct { wg sync.WaitGroup } -// PayInvoice pays an invoice. -func (h *mockLightningClient) PayInvoice(ctx context.Context, invoice string, - maxFee btcutil.Amount, - outgoingChannel *uint64) chan lndclient.PaymentResult { - - done := make(chan lndclient.PaymentResult, 1) - - h.lnd.SendPaymentChannel <- PaymentChannelMessage{ - PaymentRequest: invoice, - Done: done, - } - - return done -} - // DecodePaymentRequest returns a non-nil payment request. func (h *mockLightningClient) DecodePaymentRequest(_ context.Context, _ string) (*lndclient.PaymentRequest, error) { diff --git a/test/lnd_services_mock.go b/test/lnd_services_mock.go index 4fe5d9b5..164bea18 100644 --- a/test/lnd_services_mock.go +++ b/test/lnd_services_mock.go @@ -48,7 +48,6 @@ func NewMockLnd() *LndMockServices { ChainParams: &chaincfg.TestNet3Params, Versioner: versioner, }, - SendPaymentChannel: make(chan PaymentChannelMessage), ConfChannel: make(chan *chainntnfs.TxConfirmation), RegisterConfChannel: make(chan *ConfRegistration), RegisterSpendChannel: make(chan *SpendRegistration), @@ -95,12 +94,6 @@ func NewMockLnd() *LndMockServices { return &lnd } -// PaymentChannelMessage is the data that passed through SendPaymentChannel. -type PaymentChannelMessage struct { - PaymentRequest string - Done chan lndclient.PaymentResult -} - // TrackPaymentMessage is the data that passed through TrackPaymentChannel. type TrackPaymentMessage struct { Hash lntypes.Hash @@ -138,7 +131,6 @@ type PublishHandler func(ctx context.Context, tx *wire.MsgTx, type LndMockServices struct { lndclient.LndServices - SendPaymentChannel chan PaymentChannelMessage SpendChannel chan *chainntnfs.SpendDetail TxPublishChannel chan *wire.MsgTx SendOutputsChannel chan wire.MsgTx @@ -221,12 +213,6 @@ func (s *LndMockServices) AddTx(tx *wire.MsgTx) { // IsDone checks whether all channels have been fully emptied. If not this may // indicate unexpected behaviour of the code under test. func (s *LndMockServices) IsDone() error { - select { - case <-s.SendPaymentChannel: - return errors.New("SendPaymentChannel not empty") - default: - } - select { case <-s.SpendChannel: return errors.New("SpendChannel not empty")