mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Catch non RescanTerminatedEarly errors when rescan is terminated with an exception (#4939)
This commit is contained in:
parent
7e8002f626
commit
d297311814
@ -37,8 +37,9 @@ object RescanState {
|
||||
_isCompletedEarly.set(false)
|
||||
}
|
||||
|
||||
completeRescanEarlyP.future.failed.foreach { case RescanTerminatedEarly =>
|
||||
_isCompletedEarly.set(true)
|
||||
completeRescanEarlyP.future.failed.foreach {
|
||||
case RescanTerminatedEarly => _isCompletedEarly.set(true)
|
||||
case scala.util.control.NonFatal(_) => //do nothing
|
||||
}
|
||||
|
||||
/** Useful for determining if the rescan was completed
|
||||
|
@ -5,6 +5,7 @@ import org.bitcoins.core.currency._
|
||||
import org.bitcoins.core.protocol.script.MultiSignatureScriptPubKey
|
||||
import org.bitcoins.core.protocol.transaction.TransactionOutput
|
||||
import org.bitcoins.core.wallet.fee.SatoshisPerByte
|
||||
import org.bitcoins.core.wallet.rescan.RescanState.RescanStarted
|
||||
import org.bitcoins.crypto.ECPublicKey
|
||||
import org.bitcoins.server.BitcoinSAppConfig
|
||||
import org.bitcoins.testkit.BitcoinSTestAppConfig
|
||||
@ -196,9 +197,14 @@ class NeutrinoNodeWithWalletTest extends NodeTestWithCachedBitcoindNewest {
|
||||
_ <-
|
||||
bitcoind.getNewAddress
|
||||
.flatMap(bitcoind.generateToAddress(1, _))
|
||||
bitcoindHeight <- bitcoind.getBlockCount
|
||||
_ <- NodeTestUtil.awaitSync(node, bitcoind)
|
||||
_ <- NodeTestUtil.awaitCompactFiltersSync(node, bitcoind)
|
||||
|
||||
_ <- AsyncUtil.retryUntilSatisfiedF(() => {
|
||||
// wait until the block is processed by the wallet
|
||||
wallet
|
||||
.getSyncDescriptorOpt()
|
||||
.map(_.get.height == bitcoindHeight)
|
||||
})
|
||||
_ <- wallet.clearAllUtxos()
|
||||
addresses <- wallet.listAddresses()
|
||||
utxos <- wallet.listDefaultAccountUtxos()
|
||||
@ -207,11 +213,12 @@ class NeutrinoNodeWithWalletTest extends NodeTestWithCachedBitcoindNewest {
|
||||
|
||||
rescan <- wallet.isRescanning()
|
||||
_ = assert(!rescan)
|
||||
_ <- wallet.fullRescanNeutrinoWallet(addressBatchSize = 7)
|
||||
rescanState <- wallet.fullRescanNeutrinoWallet(addressBatchSize = 7)
|
||||
|
||||
_ <- AsyncUtil.awaitConditionF(condition,
|
||||
maxTries = 200,
|
||||
interval = 200.millis)
|
||||
_ <- rescanState.asInstanceOf[RescanStarted].stop()
|
||||
} yield succeed
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user