func (c *Client) generateExtraNonce1() error {
	id := make([]byte, 4)
	_, err := rand.Read(id)
	if err != nil {
		return err
	}
	c.extraNonce1 = hex.EncodeToString(id)
	return nil
}
generateExtraNonce1 generates a random 4-byte extraNonce1
for the client.
package pool
import (
	"bufio"
	"bytes"
	"context"
	"crypto/rand"
	"encoding/binary"
	"encoding/hex"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"math/big"
	"net"
	"strings"
	"sync"
	"sync/atomic"
	"time"
	"github.com/decred/dcrd/blockchain/standalone/v2"
	"github.com/decred/dcrd/chaincfg/chainhash"
	"github.com/decred/dcrd/chaincfg/v3"
	"github.com/decred/dcrd/dcrutil/v3"
	"github.com/decred/dcrd/wire"
	errs "github.com/decred/dcrpool/errors"
)
const (
	maxMessageSize = 250
	hashCalcThreshold = time.Second * 20
	rollWorkCycle = time.Second
)
var (
	ZeroInt = new(big.Int).SetInt64(0)
	ZeroRat = new(big.Rat).SetInt64(0)
	zeroHash = chainhash.Hash{0}
)
type readPayload struct {
	msg     Message
	msgType int
}
type ClientConfig struct {
	ActiveNet *chaincfg.Params
	db Database
	SoloPool bool
	Blake256Pad []byte
	NonceIterations float64
	FetchMinerDifficulty func(string) (*DifficultyInfo, error)
	Disconnect func()
	RemoveClient func(*Client)
	SubmitWork func(context.Context, *string) (bool, error)
	FetchCurrentWork func() string
	WithinLimit func(string, int) bool
	HashCalcThreshold time.Duration
	MaxGenTime time.Duration
	ClientTimeout time.Duration
	SignalCache func(event CacheUpdateEvent)
	MonitorCycle time.Duration
	MaxUpgradeTries uint32
	RollWorkCycle time.Duration
}
type Client struct {
	submissions  int64  
	lastWorkTime int64  
	miner    string
	id       string
	diffInfo *DifficultyInfo
	mtx      sync.RWMutex
	addr        *net.TCPAddr
	cfg         *ClientConfig
	conn        net.Conn
	encoder     *json.Encoder
	reader      *bufio.Reader
	ctx         context.Context
	cancel      context.CancelFunc
	name        string
	extraNonce1 string
	ch          chan Message
	readCh      chan readPayload
	account     string
	authorized bool
	subscribed bool
	statusMtx  sync.RWMutex
	hashRate    *big.Rat
	hashRateMtx sync.RWMutex
	wg          sync.WaitGroup
}