lotus-pcr: add toggle for message processing
This commit is contained in:
parent
49d64f7f7e
commit
9532441ed4
@ -133,6 +133,18 @@ var runCmd = &cli.Command{
|
|||||||
Usage: "do not send any messages",
|
Usage: "do not send any messages",
|
||||||
Value: false,
|
Value: false,
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "pre-commit",
|
||||||
|
EnvVars: []string{"LOTUS_PCR_PRE_COMMIT"},
|
||||||
|
Usage: "process PreCommitSector messages",
|
||||||
|
Value: true,
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "prove-commit",
|
||||||
|
EnvVars: []string{"LOTUS_PCR_PROVE_COMMIT"},
|
||||||
|
Usage: "process ProveCommitSector messages",
|
||||||
|
Value: true,
|
||||||
|
},
|
||||||
&cli.IntFlag{
|
&cli.IntFlag{
|
||||||
Name: "head-delay",
|
Name: "head-delay",
|
||||||
EnvVars: []string{"LOTUS_PCR_HEAD_DELAY"},
|
EnvVars: []string{"LOTUS_PCR_HEAD_DELAY"},
|
||||||
@ -180,12 +192,16 @@ var runCmd = &cli.Command{
|
|||||||
percentExtra := cctx.Int("percent-extra")
|
percentExtra := cctx.Int("percent-extra")
|
||||||
maxMessageQueue := cctx.Int("max-message-queue")
|
maxMessageQueue := cctx.Int("max-message-queue")
|
||||||
dryRun := cctx.Bool("dry-run")
|
dryRun := cctx.Bool("dry-run")
|
||||||
|
preCommitEnabled := cctx.Bool("pre-commit")
|
||||||
|
proveCommitEnabled := cctx.Bool("prove-commit")
|
||||||
|
|
||||||
rf := &refunder{
|
rf := &refunder{
|
||||||
api: api,
|
api: api,
|
||||||
wallet: from,
|
wallet: from,
|
||||||
percentExtra: percentExtra,
|
percentExtra: percentExtra,
|
||||||
dryRun: dryRun,
|
dryRun: dryRun,
|
||||||
|
preCommitEnabled: preCommitEnabled,
|
||||||
|
proveCommitEnabled: proveCommitEnabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
for tipset := range tipsetsCh {
|
for tipset := range tipsetsCh {
|
||||||
@ -285,6 +301,8 @@ type refunder struct {
|
|||||||
wallet address.Address
|
wallet address.Address
|
||||||
percentExtra int
|
percentExtra int
|
||||||
dryRun bool
|
dryRun bool
|
||||||
|
preCommitEnabled bool
|
||||||
|
proveCommitEnabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet) (*MinersRefund, error) {
|
func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet) (*MinersRefund, error) {
|
||||||
@ -331,7 +349,12 @@ func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet) (*Mi
|
|||||||
|
|
||||||
switch m.Method {
|
switch m.Method {
|
||||||
case builtin.MethodsMiner.ProveCommitSector:
|
case builtin.MethodsMiner.ProveCommitSector:
|
||||||
|
if !r.proveCommitEnabled {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
messageMethod = "ProveCommitSector"
|
messageMethod = "ProveCommitSector"
|
||||||
|
|
||||||
if recps[i].ExitCode != exitcode.Ok {
|
if recps[i].ExitCode != exitcode.Ok {
|
||||||
log.Debugw("skipping non-ok exitcode message", "method", messageMethod, "cid", msg.Cid, "miner", m.To, "exitcode", recps[i].ExitCode)
|
log.Debugw("skipping non-ok exitcode message", "method", messageMethod, "cid", msg.Cid, "miner", m.To, "exitcode", recps[i].ExitCode)
|
||||||
continue
|
continue
|
||||||
@ -369,6 +392,10 @@ func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet) (*Mi
|
|||||||
|
|
||||||
refundValue = collateral
|
refundValue = collateral
|
||||||
case builtin.MethodsMiner.PreCommitSector:
|
case builtin.MethodsMiner.PreCommitSector:
|
||||||
|
if !r.preCommitEnabled {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
messageMethod = "PreCommitSector"
|
messageMethod = "PreCommitSector"
|
||||||
|
|
||||||
if recps[i].ExitCode != exitcode.Ok {
|
if recps[i].ExitCode != exitcode.Ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user