Skip to content

Commit

Permalink
Fix (global.db): Test consistency with updates
Browse files Browse the repository at this point in the history
Signed-off-by: OjusWiZard <ojuswimail@gmail.com>
  • Loading branch information
OjusWiZard committed May 21, 2024
1 parent 9d3691b commit 62d32a1
Show file tree
Hide file tree
Showing 3 changed files with 354 additions and 4 deletions.
Binary file modified rotkehlchen/data/global.db
Binary file not shown.
9 changes: 8 additions & 1 deletion rotkehlchen/globaldb/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,14 @@ def _handle_asset_update(

try:
with connection.savepoint_ctx() as cursor:
executeall(cursor, action)
if action.strip().startswith('UPDATE') and cursor.execute(
'SELECT COUNT(*) FROM assets WHERE identifier=?',
(remote_asset_data.identifier,),
).fetchone()[0] == 0:
executeall(cursor, full_insert)
else:
executeall(cursor, action)

if local_asset is not None:
AssetResolver().clean_memory_cache(identifier=local_asset.identifier)
except sqlite3.Error: # https://docs.python.org/3/library/sqlite3.html#exceptions
Expand Down

0 comments on commit 62d32a1

Please sign in to comment.