Set sync height on new wallet (#3368)

This commit is contained in:
benthecarman 2021-07-06 12:33:38 -05:00 committed by GitHub
parent 09a6ca41cb
commit 629c2a2c31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -38,7 +38,12 @@ object BitcoindRpcBackendUtil extends Logging {
txDbs <- wallet.listTransactions()
lastConfirmedOpt = txDbs.filter(_.blockHashOpt.isDefined).lastOption
_ <- lastConfirmedOpt match {
case None => Future.unit
case None =>
for {
header <- bitcoind.getBestBlockHeader()
_ <- wallet.stateDescriptorDAO.updateSyncHeight(header.hashBE,
header.height)
} yield ()
case Some(txDb) =>
for {
heightOpt <- bitcoind.getBlockHeight(txDb.blockHashOpt.get)

View File

@ -81,7 +81,7 @@ abstract class Wallet
OutgoingTransactionDAO()
private[bitcoins] val addressTagDAO: AddressTagDAO = AddressTagDAO()
private[wallet] val stateDescriptorDAO: WalletStateDescriptorDAO =
private[bitcoins] val stateDescriptorDAO: WalletStateDescriptorDAO =
WalletStateDescriptorDAO()
val nodeApi: NodeApi