func (v Validator) IsActive() bool {
	return v.Status == Active || v.Status == ActivePendingExit
}
IsActive checks if the validator is active.
package primitives
import (
	"errors"
	"fmt"
	"sync"
	"github.com/phoreproject/synapse/bls"
	"github.com/phoreproject/synapse/chainhash"
	"github.com/phoreproject/synapse/pb"
)
const (
	Active = iota
	ActivePendingExit
	PendingActivation
	ExitedWithoutPenalty
	ExitedWithPenalty
)
var pubkeyCache = make(map[[96]byte]bls.PublicKey)
var pubkeyCacheLock = new(sync.RWMutex)
func lookupPubkey(pk [96]byte) *bls.PublicKey {
	pubkeyCacheLock.RLock()
	out, found := pubkeyCache[pk]
	pubkeyCacheLock.RUnlock()
	if found {
		return &out
	}
	return nil
}
func setPubkey(pkSer [96]byte, pub *bls.PublicKey) {
	pubkeyCacheLock.Lock()
	pubkeyCache[pkSer] = *pub
	pubkeyCacheLock.Unlock()
}
type Validator struct {
	Pubkey [96]byte
	WithdrawalCredentials chainhash.Hash
	Status uint64
	LatestStatusChangeSlot uint64
	ExitCount uint64
	LastPoCChangeSlot uint64
	SecondLastPoCChangeSlot uint64
}
func (v *Validator) GetPublicKey() (*bls.PublicKey, error) {
	if pub := lookupPubkey(v.Pubkey); pub != nil {
		return pub, nil
	}
	pub, err := bls.DeserializePublicKey(v.Pubkey)
	if err != nil {
		return nil, err
	}
	setPubkey(v.Pubkey, pub)
	return pub, nil
}
func (v *Validator) Copy() Validator {
	return *v
}