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" """); }