Setup PeerTagger as Invoke

This commit is contained in:
Łukasz Magiera 2019-12-17 17:28:02 +01:00
parent 8d0d2b2fae
commit 8284436eae
3 changed files with 4 additions and 6 deletions

View File

@ -40,7 +40,6 @@ import (
"github.com/filecoin-project/lotus/node/modules/helpers" "github.com/filecoin-project/lotus/node/modules/helpers"
"github.com/filecoin-project/lotus/node/modules/lp2p" "github.com/filecoin-project/lotus/node/modules/lp2p"
"github.com/filecoin-project/lotus/node/modules/testing" "github.com/filecoin-project/lotus/node/modules/testing"
"github.com/filecoin-project/lotus/node/peers"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/paych" "github.com/filecoin-project/lotus/paych"
"github.com/filecoin-project/lotus/peermgr" "github.com/filecoin-project/lotus/peermgr"
@ -101,6 +100,7 @@ const (
// daemon // daemon
ExtractApiKey ExtractApiKey
HeadMetricsKey HeadMetricsKey
RunPeerTaggerKey
SetApiEndpointKey SetApiEndpointKey
@ -234,7 +234,7 @@ func Online() Option {
Override(new(*paych.Store), paych.NewStore), Override(new(*paych.Store), paych.NewStore),
Override(new(*paych.Manager), paych.NewManager), Override(new(*paych.Manager), paych.NewManager),
Override(new(*market.FundMgr), market.NewFundMgr), Override(new(*market.FundMgr), market.NewFundMgr),
Override(new(*peers.PeerTagger), lp2p.TagMiners), Override(RunPeerTaggerKey, lp2p.TagMiners),
), ),
// Storage miner // Storage miner

View File

@ -14,7 +14,6 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/peers"
) )
type CommonAPI struct { type CommonAPI struct {
@ -22,7 +21,6 @@ type CommonAPI struct {
APISecret *dtypes.APIAlg APISecret *dtypes.APIAlg
Host host.Host Host host.Host
PeerTagger *peers.PeerTagger // TODO: this needs a better home
} }
type jwtPayload struct { type jwtPayload struct {

View File

@ -100,7 +100,7 @@ func simpleOpt(opt libp2p.Option) func() (opts Libp2pOpts, err error) {
} }
} }
func TagMiners(lc fx.Lifecycle, h host.Host, stmgr *stmgr.StateManager) *peers.PeerTagger { func TagMiners(lc fx.Lifecycle, h host.Host, stmgr *stmgr.StateManager) {
pt := peers.NewPeerTagger(h, stmgr) pt := peers.NewPeerTagger(h, stmgr)
lc.Append(fx.Hook{ lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error { OnStart: func(ctx context.Context) error {
@ -112,5 +112,5 @@ func TagMiners(lc fx.Lifecycle, h host.Host, stmgr *stmgr.StateManager) *peers.P
}, },
}) })
return pt return
} }