Skip to content

Commit

Permalink
Merge pull request #713 from oasisprotocol/ptrus/fix/dont-track-0-shares
Browse files Browse the repository at this point in the history
delegations: do not track rewards as delegations
  • Loading branch information
ptrus authored Jun 21, 2024
2 parents d97ead5 + 4dd6005 commit 6652908
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions .changelog/713.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delegations: do not track rewards as delegations
16 changes: 11 additions & 5 deletions analyzer/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6652908

Please sign in to comment.