Add command to unregister miner from full node manually

This commit is contained in:
whyrusleeping
2019-10-31 15:04:13 -07:00
parent bad7b76165
commit a954ebc6b6
5 changed files with 40 additions and 5 deletions
+5 -1
View File
@@ -2,6 +2,7 @@ package modules
import (
"context"
"fmt"
"path/filepath"
"github.com/ipfs/go-bitswap"
@@ -154,7 +155,10 @@ func RegisterMiner(lc fx.Lifecycle, ds dtypes.MetadataDS, api api.FullNode) erro
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
log.Infof("Registering miner '%s' with full node", minerAddr)
return api.MinerRegister(ctx, minerAddr)
if err := api.MinerRegister(ctx, minerAddr); err != nil {
return fmt.Errorf("Failed to register miner: %s\nIf you are certain no other storage miner instance is running, try running 'lotus unregister-miner %s' and restarting the storage miner", err, minerAddr)
}
return nil
},
OnStop: func(ctx context.Context) error {
log.Infof("Unregistering miner '%s' from full node", minerAddr)