Skip to content

Commit

Permalink
Better logs for RewardsRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsporn committed May 2, 2024
1 parent 1ff3234 commit b0dc062
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package performance

import (
"fmt"

"github.com/iotaledger/hive.go/ads"
"github.com/iotaledger/hive.go/core/safemath"
"github.com/iotaledger/hive.go/ierrors"
"github.com/iotaledger/hive.go/lo"
"github.com/iotaledger/hive.go/stringify"
"github.com/iotaledger/iota-core/pkg/model"
iotago "github.com/iotaledger/iota.go/v4"
)
Expand All @@ -20,14 +23,20 @@ func (t *Tracker) RewardsRoot(epoch iotago.EpochIndex) (iotago.Identifier, error

root := m.Root()

t.LogDebug("RewardsRoot", "epoch", epoch, "root", root, "WasRestoredFromStorage", m.WasRestoredFromStorage())
builder := stringify.NewStructBuilder("RewardsRoot")
builder.AddField(stringify.NewStructField("Root", root))
builder.AddField(stringify.NewStructField("WasRestoredFromStorage", m.WasRestoredFromStorage()))

if err := m.Stream(func(accountID iotago.AccountID, poolRewards *model.PoolRewards) error {
t.LogDebug("RewardsRoot", "accountID", accountID, "poolRewards", poolRewards)
t.LogDebug("> RewardsRoot", "epoch", epoch, "accountID", accountID, "poolRewards", poolRewards)
builder.AddField(stringify.NewStructField(fmt.Sprintf("account[%s]", accountID.String()), poolRewards))
return nil

Check failure on line 33 in pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go

View workflow job for this annotation

GitHub Actions / GolangCI-Lint

return with no blank line before (nlreturn)
}); err != nil {
panic(err)
}

t.LogDebug("RewardsRoot", "epoch", epoch, "rewardsMap", builder.String())

return root, nil
}

Expand Down

0 comments on commit b0dc062

Please sign in to comment.