From af74450c62454f1ca7635b597acd1d8acaffbce6 Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Wed, 31 Jan 2024 10:24:44 -0600 Subject: [PATCH] Cancel polling job after walletTest is executed (#5379) --- .../wallet/BitcoindBlockPollingTest.scala | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/wallet-test/src/test/scala/org/bitcoins/wallet/BitcoindBlockPollingTest.scala b/wallet-test/src/test/scala/org/bitcoins/wallet/BitcoindBlockPollingTest.scala index 2e8baabfcf..dd88025734 100644 --- a/wallet-test/src/test/scala/org/bitcoins/wallet/BitcoindBlockPollingTest.scala +++ b/wallet-test/src/test/scala/org/bitcoins/wallet/BitcoindBlockPollingTest.scala @@ -45,10 +45,10 @@ class BitcoindBlockPollingTest _ = assert(firstBalance == Satoshis.zero) // Setup block polling - _ = BitcoindRpcBackendUtil.startBitcoindBlockPolling(wallet, - bitcoind, - None, - 1.second) + cancellable = BitcoindRpcBackendUtil.startBitcoindBlockPolling(wallet, + bitcoind, + None, + 1.second) _ <- bitcoind.generateToAddress(6, bech32Address) // Wait for it to process @@ -57,6 +57,7 @@ class BitcoindBlockPollingTest 1.second) balance <- wallet.getConfirmedBalance() + _ = cancellable.cancel() } yield assert(balance == amountToSend) } @@ -83,9 +84,10 @@ class BitcoindBlockPollingTest txid1 <- bitcoind.sendToAddress(addr, amountToSend) // Setup block polling - _ = BitcoindRpcBackendUtil.startBitcoindMempoolPolling(wallet, - bitcoind, - 1.second) { tx => + cancellable = BitcoindRpcBackendUtil.startBitcoindMempoolPolling( + wallet, + bitcoind, + 1.second) { tx => mempoolTxs += tx FutureUtil.unit } @@ -101,6 +103,7 @@ class BitcoindBlockPollingTest _.txIdBE == txid2) }, 1.second) + _ = cancellable.cancel() } yield succeed } }