func (appDB *AppDB) SetValidators(vals types.ValidatorUpdates) {
	appDB.validators = vals
}
SetValidators sets given validators list on mem
package appdb
import (
	"encoding/binary"
	"github.com/MinterTeam/minter-go-node/config"
	"github.com/tendermint/tendermint/abci/types"
	abciTypes "github.com/tendermint/tendermint/abci/types"
	tmjson "github.com/tendermint/tendermint/libs/json"
	"github.com/tendermint/tm-db"
	"sync/atomic"
	"time"
)
const (
	hashPath        = "hash"
	heightPath      = "height"
	startHeightPath = "startHeight"
	blocksTimePath  = "blockDelta"
	validatorsPath  = "validators"
	versionsPath    = "versions"
	dbName = "app"
)
type AppDB struct {
	db             db.DB
	startHeight    uint64
	lastHeight     uint64
	lastTimeBlocks []uint64
	validators     abciTypes.ValidatorUpdates
	isDirtyVersions bool
	versions        []*Version
}
func (appDB *AppDB) Close() error {
	if err := appDB.db.Close(); err != nil {
		return err
	}
	return nil
}
func (appDB *AppDB) GetLastBlockHash() []byte {
	rawHash, err := appDB.db.Get([]byte(hashPath))
	if err != nil {
		panic(err)
	}
	if len(rawHash) == 0 {
		return nil
	}
	var hash [32]byte
	copy(hash[:], rawHash)
	return hash[:]
}
func (appDB *AppDB) SetLastBlockHash(hash []byte) {
	if err := appDB.db.Set([]byte(hashPath), hash); err != nil {
		panic(err)
	}
}
func (appDB *AppDB) GetLastHeight() uint64 {
	val := atomic.LoadUint64(&appDB.lastHeight)
	if val != 0 {
		return val
	}
	result, err := appDB.db.Get([]byte(heightPath))
	if err != nil {
		panic(err)
	}
	if len(result) != 0 {
		val = binary.BigEndian.Uint64(result)
		atomic.StoreUint64(&appDB.lastHeight, val)
	}
	return val
}
func (appDB *AppDB) SetLastHeight(height uint64) {
	h := make([]byte, 8)
	binary.BigEndian.PutUint64(h, height)
	if err := appDB.db.Set([]byte(heightPath), h); err != nil {
		panic(err)
	}
	atomic.StoreUint64(&appDB.lastHeight, height)
}
func (appDB *AppDB) SetStartHeight(height uint64) {
	atomic.StoreUint64(&appDB.startHeight, height)
}
func (appDB *AppDB) SaveStartHeight() {
	h := make([]byte, 8)
	binary.BigEndian.PutUint64(h, atomic.LoadUint64(&appDB.startHeight))
	if err := appDB.db.Set([]byte(startHeightPath), h); err != nil {
		panic(err)
	}
}
func (appDB *AppDB) GetStartHeight() uint64 {
	val := atomic.LoadUint64(&appDB.startHeight)
	if val != 0 {
		return val
	}
	result, err := appDB.db.Get([]byte(startHeightPath))
	if err != nil {
		panic(err)
	}
	if len(result) != 0 {
		val = binary.BigEndian.Uint64(result)
		atomic.StoreUint64(&appDB.startHeight, val)
	}
	return val
}
func (appDB *AppDB) GetValidators() types.ValidatorUpdates {
	if appDB.validators != nil {
		return appDB.validators
	}
	result, err := appDB.db.Get([]byte(validatorsPath))
	if err != nil {
		panic(err)
	}
	if len(result) == 0 {
		return types.ValidatorUpdates{}
	}
	var vals types.ValidatorUpdates
	err = tmjson.Unmarshal(result, &vals)
	if err != nil {
		panic(err)
	}
	return vals
}