Skip to content

Commit

Permalink
Remove unused provided config params
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Apr 30, 2024
1 parent 17ae11b commit ab9f161
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions components/p2p/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/iotaledger/hive.go/app"
"github.com/iotaledger/hive.go/app/configuration"
hivep2p "github.com/iotaledger/hive.go/crypto/p2p"
"github.com/iotaledger/hive.go/db"
"github.com/iotaledger/hive.go/ierrors"
"github.com/iotaledger/iota-core/pkg/daemon"
"github.com/iotaledger/iota-core/pkg/network"
Expand All @@ -25,13 +24,12 @@ import (

func init() {
Component = &app.Component{
Name: "P2P",
DepsFunc: func(cDeps dependencies) { deps = cDeps },
Params: params,
InitConfigParams: initConfigParams,
Provide: provide,
Configure: configure,
Run: run,
Name: "P2P",
DepsFunc: func(cDeps dependencies) { deps = cDeps },
Params: params,
Provide: provide,
Configure: configure,
Run: run,
}
}

Expand All @@ -48,23 +46,6 @@ type dependencies struct {
Protocol *protocol.Protocol
}

func initConfigParams(c *dig.Container) error {
type cfgResult struct {
dig.Out
P2PBindMultiAddresses []string `name:"p2pBindMultiAddresses"`
}

if err := c.Provide(func() cfgResult {
return cfgResult{
P2PBindMultiAddresses: ParamsP2P.BindMultiAddresses,
}
}); err != nil {
Component.LogPanic(err.Error())
}

return nil
}

func provide(c *dig.Container) error {
type configManagerDeps struct {
dig.In
Expand Down Expand Up @@ -137,19 +118,13 @@ func provide(c *dig.Container) error {
Component.LogPanic(err.Error())
}

type p2pDeps struct {
dig.In
DatabaseEngine db.Engine `name:"databaseEngine"`
P2PBindMultiAddresses []string `name:"p2pBindMultiAddresses"`
}

type p2pResult struct {
dig.Out
NodePrivateKey crypto.PrivKey `name:"nodePrivateKey"`
Host host.Host
}

if err := c.Provide(func(deps p2pDeps) p2pResult {
if err := c.Provide(func() p2pResult {
res := p2pResult{}

// make sure nobody copies around the peer store since it contains the private key of the node
Expand Down

0 comments on commit ab9f161

Please sign in to comment.