Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
log rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed Jan 15, 2022
1 parent 7d30bca commit 9d0968c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions chain/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,18 +614,20 @@ func ApplyReward(db database.Database, blkID ids.ID, txID ids.ID, sender common.
if _, err := Unmarshal(cursor.Value(), &i); err != nil {
return err
}
space := string(curKey[2:])

// Do not give sender their funds back
if bytes.Equal(i.Owner[:], sender[:]) {
log.Debug("skipping reward: same owner", "owner", i.Owner)
log.Debug("skipping reward: same owner", "space", space, "owner", i.Owner)
return nil
}

// Distribute reward
if _, err := ModifyBalance(db, i.Owner, true, reward); err != nil {
return err
}
log.Debug("rewarded space owner", "owner", i.Owner, "amount", reward)

log.Debug("rewarded space owner", "space", space, "owner", i.Owner, "amount", reward)
return nil
}

Expand Down

0 comments on commit 9d0968c

Please sign in to comment.