make sure we set the syncto height correctly when we roll back instea… (#11389)

* make sure we set the syncto height correctly when we roll back instead of noop

* don't error out if height is -1 on rollback
This commit is contained in:
wjblanke
2022-05-02 15:55:45 -07:00
committed by GitHub
parent 6fe7116730
commit 8905dc69ac
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -184,8 +184,8 @@ class WalletBlockchain(BlockchainInterface):
return self._peak
return await self._basic_store.get_object("PEAK_BLOCK", HeaderBlock)
async def set_finished_sync_up_to(self, height: int, in_transaction=False):
if height > await self.get_finished_sync_up_to():
async def set_finished_sync_up_to(self, height: int, in_transaction=False, in_rollback=False):
if (in_rollback and height >= 0) or (height > await self.get_finished_sync_up_to()):
await self._basic_store.set_object("FINISHED_SYNC_UP_TO", uint32(height), in_transaction)
if not in_transaction:
await self.clean_block_records()
+1 -1
View File
@@ -479,7 +479,7 @@ class WalletNode:
try:
await self.wallet_state_manager.db_wrapper.begin_transaction()
removed_wallet_ids = await self.wallet_state_manager.reorg_rollback(fork_height)
await self.wallet_state_manager.blockchain.set_finished_sync_up_to(fork_height, True)
await self.wallet_state_manager.blockchain.set_finished_sync_up_to(fork_height, True, in_rollback=True)
if cache is None:
self.rollback_request_caches(fork_height)
else: