2023-09-21 15:37:02 +00:00
|
|
|
package modules
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.uber.org/fx"
|
2023-11-14 00:06:11 +00:00
|
|
|
|
2023-09-21 15:37:02 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/gen/slashfilter/slashsvc"
|
|
|
|
"github.com/filecoin-project/lotus/node/config"
|
|
|
|
"github.com/filecoin-project/lotus/node/impl/full"
|
|
|
|
"github.com/filecoin-project/lotus/node/modules/helpers"
|
|
|
|
)
|
|
|
|
|
|
|
|
type consensusReporterModules struct {
|
|
|
|
fx.In
|
|
|
|
|
|
|
|
full.WalletAPI
|
|
|
|
full.ChainAPI
|
|
|
|
full.MpoolAPI
|
|
|
|
full.SyncAPI
|
|
|
|
}
|
|
|
|
|
|
|
|
func RunConsensusFaultReporter(config config.FaultReporterConfig) func(mctx helpers.MetricsCtx, lc fx.Lifecycle, mod consensusReporterModules) error {
|
|
|
|
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, mod consensusReporterModules) error {
|
|
|
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
|
|
|
|
|
|
|
return slashsvc.SlashConsensus(ctx, &mod, config.ConsensusFaultReporterDataDir, config.ConsensusFaultReporterAddress)
|
|
|
|
}
|
|
|
|
}
|