func (c *Client) HealthCheck() error {
	if c.fakeMode {
		return nil
	}
	ctx, cancel := context.WithTimeout(c.ctx, requestTimeout)
	defer cancel()
	start := time.Now()
	_, err := c.cmkt.MarketListIncompleteDeals(ctx)
	log.Infof("MarketListIncompleteDeals call took %v", time.Since(start))
	return err
}
HealthCheck checks if the lotus client is healthy enough so bidbot can
participate in bidding.
package lotusclient
import (
	"context"
	"fmt"
	"io"
	"net/http"
	"time"
	"github.com/filecoin-project/go-jsonrpc"
	"github.com/filecoin-project/lotus/api"
	"github.com/ipfs/go-cid"
	ma "github.com/multiformats/go-multiaddr"
	dns "github.com/multiformats/go-multiaddr-dns"
	"github.com/textileio/go-libp2p-pubsub-rpc/finalizer"
	golog "github.com/textileio/go-log/v2"
)
var (
	log = golog.Logger("bidbot/lotus")
	requestTimeout = time.Second * 10
)
type LotusClient interface {
	io.Closer
	HealthCheck() error
	CurrentSealingSectors() (int, error)
	ImportData(pcid cid.Cid, file string) error
}
type Client struct {
	cmin     api.StorageMiner
	cmkt     api.StorageMiner
	fakeMode bool
	ctx       context.Context
	finalizer *finalizer.Finalizer
}
func New(maddr string, authToken string, marketMaddr string, marketAuthToken string,
	connRetries int, fakeMode bool) (*Client, error) {
	fin := finalizer.NewFinalizer()
	ctx, cancel := context.WithCancel(context.Background())
	fin.Add(finalizer.NewContextCloser(cancel))
	lc := &Client{
		fakeMode:  fakeMode,
		ctx:       ctx,
		finalizer: fin,
	}
	if lc.fakeMode {
		return lc, nil
	}
	builder, err := newBuilder(maddr, authToken, connRetries)
	if err != nil {
		return nil, fmt.Errorf("building lotus client: %w", err)
	}
	cmin, closer, err := builder(lc.ctx)
	if err != nil {
		return nil, fmt.Errorf("starting lotus client: %w", err)
	}
	fin.AddFn(closer)
	var cmkt api.StorageMiner
	if marketMaddr != "" {
		builder, err = newBuilder(marketMaddr, marketAuthToken, connRetries)
		if err != nil {
			return nil, fmt.Errorf("building lotus market client: %w", err)
		}
		cmkt, closer, err = builder(lc.ctx)
		if err != nil {
			return nil, fmt.Errorf("starting lotus market client: %w", err)
		}
		fin.AddFn(closer)
	} else {
		cmkt = cmin
	}
	client := &Client{
		cmin:      cmin,
		cmkt:      cmkt,
		fakeMode:  fakeMode,
		ctx:       ctx,
		finalizer: fin,
	}
	if err := client.HealthCheck(); err != nil {
		return nil, fmt.Errorf("lotus client fails health check: %w", err)
	}
	return client, nil
}
func (c *Client) Close() error {
	return c.finalizer.Cleanup(nil)
}