From fbc0028e90a9a7cfa97994c33ad795d9c3e24c84 Mon Sep 17 00:00:00 2001 From: ffranr Date: Wed, 20 Sep 2023 19:28:47 +0100 Subject: [PATCH] tapgarden: pre proof retrieval delay respects context done signal --- tapgarden/custodian.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tapgarden/custodian.go b/tapgarden/custodian.go index ab33d2d2e..e528b6d66 100644 --- a/tapgarden/custodian.go +++ b/tapgarden/custodian.go @@ -388,7 +388,14 @@ func (c *Custodian) inspectWalletTx(walletTx *lndclient.Transaction) error { // Sleep to give the sender an opportunity to transfer // the proof to the proof courier service. - time.Sleep(defaultProofRetrievalDelay) + // Without this delay our first attempt at retrieving + // the proof will very likely fail. We should expect + // retrieval success before this delay. + select { + case <-time.After(defaultProofRetrievalDelay): + case <-ctx.Done(): + return + } // Attempt to receive proof via proof courier service. loc := proof.Locator{