Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 8994615

Browse files
committed
Better logs for RewardsRoot
1 parent 1ff3234 commit 8994615

File tree

1 file changed

+11
-2
lines changed
  • pkg/protocol/sybilprotection/sybilprotectionv1/performance

1 file changed

+11
-2
lines changed

pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package performance
22

33
import (
4+
"fmt"
5+
46
"github.com/iotaledger/hive.go/ads"
57
"github.com/iotaledger/hive.go/core/safemath"
68
"github.com/iotaledger/hive.go/ierrors"
79
"github.com/iotaledger/hive.go/lo"
10+
"github.com/iotaledger/hive.go/stringify"
811
"github.com/iotaledger/iota-core/pkg/model"
912
iotago "github.com/iotaledger/iota.go/v4"
1013
)
@@ -20,14 +23,20 @@ func (t *Tracker) RewardsRoot(epoch iotago.EpochIndex) (iotago.Identifier, error
2023

2124
root := m.Root()
2225

23-
t.LogDebug("RewardsRoot", "epoch", epoch, "root", root, "WasRestoredFromStorage", m.WasRestoredFromStorage())
26+
builder := stringify.NewStructBuilder("RewardsRoot")
27+
builder.AddField(stringify.NewStructField("Root", root))
28+
builder.AddField(stringify.NewStructField("WasRestoredFromStorage", m.WasRestoredFromStorage()))
29+
2430
if err := m.Stream(func(accountID iotago.AccountID, poolRewards *model.PoolRewards) error {
25-
t.LogDebug("RewardsRoot", "accountID", accountID, "poolRewards", poolRewards)
31+
builder.AddField(stringify.NewStructField(fmt.Sprintf("account[%s]", accountID.String()), poolRewards))
32+
2633
return nil
2734
}); err != nil {
2835
panic(err)
2936
}
3037

38+
t.LogDebug("RewardsRoot", "epoch", epoch, "rewardsMap", builder)
39+
3140
return root, nil
3241
}
3342

0 commit comments

Comments
 (0)