mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 10:05:29 -05:00
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:
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user