From b54ad2a1e30b8e0446b6b99937371af0a4bdcd66 Mon Sep 17 00:00:00 2001 From: 257Byte <257byte@gmail.com> Date: Thu, 1 Aug 2024 18:48:08 +0300 Subject: [PATCH] Fix snapshots --- .../Proto1/Activation/ProtoActivator.SnapshotBalances.cs | 2 +- .../Protocols/Handlers/Proto18/Commits/SnapshotBalanceCommit.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tzkt.Sync/Protocols/Handlers/Proto1/Activation/ProtoActivator.SnapshotBalances.cs b/Tzkt.Sync/Protocols/Handlers/Proto1/Activation/ProtoActivator.SnapshotBalances.cs index 7ab71a89..e923f6e1 100644 --- a/Tzkt.Sync/Protocols/Handlers/Proto1/Activation/ProtoActivator.SnapshotBalances.cs +++ b/Tzkt.Sync/Protocols/Handlers/Proto1/Activation/ProtoActivator.SnapshotBalances.cs @@ -29,7 +29,7 @@ public void BootstrapSnapshotBalances(List accounts) AccountId = x.Id, BakerId = x.DelegateId ?? x.Id, - OwnDelegatedBalance = x.Balance - (x as Data.Models.Delegate)?.OwnStakedBalance ?? 0, + OwnDelegatedBalance = x.Balance - ((x as Data.Models.Delegate)?.OwnStakedBalance ?? 0), ExternalDelegatedBalance = (x as Data.Models.Delegate)?.DelegatedBalance ?? 0, DelegatorsCount = (x as Data.Models.Delegate)?.DelegatorsCount ?? 0, diff --git a/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/SnapshotBalanceCommit.cs b/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/SnapshotBalanceCommit.cs index f351cbf6..9093984c 100644 --- a/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/SnapshotBalanceCommit.cs +++ b/Tzkt.Sync/Protocols/Handlers/Proto18/Commits/SnapshotBalanceCommit.cs @@ -83,7 +83,7 @@ UNION ALL INNER JOIN "Accounts" as unstakedBaker ON unstakedBaker."Id" = account."UnstakedBakerId" WHERE unstakedBaker."Staked" = true - AND account."UnstakedBakerId" != account."DelegateId" + AND account."UnstakedBakerId" IS DISTINCT FROM account."DelegateId" AND account."UnstakedBakerId" != account."Id" """); }