Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Apr 17, 2024
1 parent bb10d1a commit 7150a3d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions components/dashboard_metrics/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type dependencies struct {
Protocol *protocol.Protocol
RestRouteManager *restapipkg.RestRouteManager
AppInfo *app.Info
P2PMetrics *p2p.P2PMetrics
P2PMetrics *p2p.Metrics
}

func configure() error {
Expand All @@ -67,7 +67,7 @@ func configure() error {
deps.P2PMetrics.IncomingBlocks.Add(1)
})

deps.Protocol.Events.Engine.BlockRetainer.BlockRetained.Hook(func(block *blocks.Block) {
deps.Protocol.Events.Engine.BlockRetainer.BlockRetained.Hook(func(_ *blocks.Block) {
deps.P2PMetrics.IncomingNewBlocks.Add(1)
})

Expand Down
6 changes: 3 additions & 3 deletions components/p2p/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ func provide(c *dig.Container) error {
Component.LogPanic(err.Error())
}

if err := c.Provide(func() *p2p.P2PMetrics {
return &p2p.P2PMetrics{}
if err := c.Provide(func() *p2p.Metrics {
return &p2p.Metrics{}
}); err != nil {
Component.LogPanic(err.Error())
}
Expand All @@ -255,7 +255,7 @@ func provide(c *dig.Container) error {
dig.In
Host host.Host
PeerDB *network.DB
P2PMetrics *p2p.P2PMetrics
P2PMetrics *p2p.Metrics
}

return c.Provide(func(inDeps p2pManagerDeps) network.Manager {
Expand Down
4 changes: 1 addition & 3 deletions components/prometheus/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ func run() error {
}

func provide(c *dig.Container) error {
return c.Provide(func() *collector.Collector {
return collector.New()
})
return c.Provide(collector.New)
}

func registerMetrics() {
Expand Down
4 changes: 2 additions & 2 deletions pkg/network/p2p/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"sync/atomic"
)

// P2PMetrics defines P2P metrics over the entire runtime of the node.
type P2PMetrics struct {
// Metrics defines P2P metrics over the entire runtime of the node.
type Metrics struct {
// The number of total received blocks.
IncomingBlocks atomic.Uint32
// The number of received blocks which are new.
Expand Down
1 change: 1 addition & 0 deletions pkg/network/p2p/neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func (n *neighbor) writeLoop() {
}

if n.onBlockSentCallback != nil {
//nolint:forcetypeassert // we know that the packet is a nwmodels.Packet
if block := sendPacket.packet.(*nwmodels.Packet).GetBlock(); block != nil {
n.onBlockSentCallback()
}
Expand Down

0 comments on commit 7150a3d

Please sign in to comment.