From 1fa8ca72ee47bb9e80d6fc7f0705d0e2d55930c5 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 20 Mar 2024 15:05:25 +0800 Subject: [PATCH] sweep: fix `handlePendingSweepsReq` linter issue Turns out the param was never used, we now fix it by sending the response in the method and also catch the quit channel. --- sweep/sweeper.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sweep/sweeper.go b/sweep/sweeper.go index 610bb819b..879e15c13 100644 --- a/sweep/sweeper.go +++ b/sweep/sweeper.go @@ -672,7 +672,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) { // A new external request has been received to retrieve all of // the inputs we're currently attempting to sweep. case req := <-s.pendingSweepsReqs: - req.respChan <- s.handlePendingSweepsReq(req) + s.handlePendingSweepsReq(req) // A new external request has been received to bump the fee rate // of a given input. @@ -1058,6 +1058,13 @@ func (s *UtxoSweeper) handlePendingSweepsReq( } } + select { + case req.respChan <- resps: + case <-s.quit: + log.Debug("Skipped sending pending sweep response due to " + + "UtxoSweeper shutting down") + } + return resps }