Fetch blockHeight earlier in TransactionProcessing.processBlock() (#4025)

This commit is contained in:
Chris Stewart 2022-01-30 16:41:29 -06:00 committed by GitHub
parent 8d04ca1cd3
commit 883b01006d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,7 @@ private[bitcoins] trait TransactionProcessing extends WalletLogger {
logger.info(s"Processing block=${block.blockHeader.hash.flip.hex}")
val start = TimeUtil.currentEpochMs
val isEmptyF = isEmpty()
val heightF = chainQueryApi.getBlockHeight(block.blockHeader.hashBE)
val resF = for {
isEmpty <- isEmptyF
newWallet <- {
@ -69,7 +70,7 @@ private[bitcoins] trait TransactionProcessing extends WalletLogger {
val f = for {
res <- resF
hash = block.blockHeader.hashBE
height <- chainQueryApi.getBlockHeight(hash)
height <- heightF
_ <- stateDescriptorDAO.updateSyncHeight(hash, height.get)
_ <- walletConfig.walletCallbacks.executeOnBlockProcessed(logger, block)
} yield {