diff --git a/.changelog/713.bugfix.md b/.changelog/713.bugfix.md new file mode 100644 index 000000000..adc7a715d --- /dev/null +++ b/.changelog/713.bugfix.md @@ -0,0 +1 @@ +delegations: do not track rewards as delegations diff --git a/analyzer/consensus/consensus.go b/analyzer/consensus/consensus.go index 6461f3928..a3d281ddd 100644 --- a/analyzer/consensus/consensus.go +++ b/analyzer/consensus/consensus.go @@ -881,11 +881,17 @@ func (m *processor) queueEscrows(batch *storage.QueryBatch, data *stakingData) e amount, newShares, ) - batch.Queue(queries.ConsensusAddDelegationsUpsert, - escrower, - owner, - newShares, - ) + if newShares != "0" { + // When rewards are distributed, an `AddEscrowEvent` with `new_shares` set to 0 is emitted. This makes sense, + // since rewards increase the Escrow balance without adding new shares - it increases the existing shares price. + // + // Do not track these as delegations. + batch.Queue(queries.ConsensusAddDelegationsUpsert, + escrower, + owner, + newShares, + ) + } } for _, e := range data.TakeEscrows { if e.DebondingAmount == nil {