Skip to content

Commit

Permalink
Fixing duplicate transactions on mainnet sync (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
naps62 committed May 14, 2024
1 parent a36b61e commit 5bef4d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/sync/alchemy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ impl Alchemy {
.get_asset_transfers(Direction::To(address), from_block, latest)
.await?;

tracing::trace!("inc {}, out {}", inc.0.len(), out.0.len());

let tip = out
.0
.iter()
Expand All @@ -72,7 +74,7 @@ impl Alchemy {
self.db.save_erc20_metadatas(self.chain_id, out.1).await?;

if tip > std::u64::MIN {
self.db.kv_set(&(self.chain_id, address), &tip).await?;
self.db.kv_set(&key, &tip).await?;
}

Ok(())
Expand Down
2 changes: 2 additions & 0 deletions migrations/21_clear_transactions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- clean up transactions table, we need to re-sync after a bugfix
DELETE * from transactions;

0 comments on commit 5bef4d3

Please sign in to comment.