func (f *Fixtures) UnsafeResetAll(flags ...string) {
	cmd := server.UnsafeResetAllCmd()
	_, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags("", flags...))
	require.NoError(f.T, err)
	err = os.RemoveAll(filepath.Join(f.Home, "config", "gentx"))
	require.NoError(f.T, err)
}
___________________________________________________________________________________
lfb
UnsafeResetAll is lfb unsafe-reset-all
package clitest
import (
	"bufio"
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
	"os/exec"
	"path"
	"path/filepath"
	"strings"
	"sync/atomic"
	"testing"
	"time"
	"github.com/spf13/cobra"
	"github.com/stretchr/testify/require"
	"github.com/line/lfb/app"
	lfbcmd "github.com/line/lfb/cmd/lfb/cmd"
	lfbtypes "github.com/line/lfb/types"
	"github.com/line/lbm-sdk/baseapp"
	"github.com/line/lbm-sdk/client"
	clientkeys "github.com/line/lbm-sdk/client/keys"
	"github.com/line/lbm-sdk/client/rpc"
	"github.com/line/lbm-sdk/codec/legacy"
	"github.com/line/lbm-sdk/crypto/hd"
	"github.com/line/lbm-sdk/crypto/keyring"
	"github.com/line/lbm-sdk/server"
	srvconfig "github.com/line/lbm-sdk/server/config"
	servertypes "github.com/line/lbm-sdk/server/types"
	storetypes "github.com/line/lbm-sdk/store/types"
	"github.com/line/lbm-sdk/testutil"
	testcli "github.com/line/lbm-sdk/testutil/cli"
	testnet "github.com/line/lbm-sdk/testutil/network"
	sdk "github.com/line/lbm-sdk/types"
	"github.com/line/lbm-sdk/types/tx"
	authcli "github.com/line/lbm-sdk/x/auth/client/cli"
	authtypes "github.com/line/lbm-sdk/x/auth/types"
	bankcli "github.com/line/lbm-sdk/x/bank/client/cli"
	banktypes "github.com/line/lbm-sdk/x/bank/types"
	distcli "github.com/line/lbm-sdk/x/distribution/client/cli"
	disttypes "github.com/line/lbm-sdk/x/distribution/types"
	"github.com/line/lbm-sdk/x/genutil"
	genutilcli "github.com/line/lbm-sdk/x/genutil/client/cli"
	govcli "github.com/line/lbm-sdk/x/gov/client/cli"
	gov "github.com/line/lbm-sdk/x/gov/types"
	slashingcli "github.com/line/lbm-sdk/x/slashing/client/cli"
	slashing "github.com/line/lbm-sdk/x/slashing/types"
	stakingcli "github.com/line/lbm-sdk/x/staking/client/cli"
	staking "github.com/line/lbm-sdk/x/staking/types"
	wasmcli "github.com/line/lbm-sdk/x/wasm/client/cli"
	wasmtypes "github.com/line/lbm-sdk/x/wasm/types"
	ostcfg "github.com/line/ostracon/config"
	ostflags "github.com/line/ostracon/libs/cli/flags"
	"github.com/line/ostracon/libs/log"
	osthttp "github.com/line/ostracon/rpc/client/http"
	ostctypes "github.com/line/ostracon/rpc/core/types"
	osttypes "github.com/line/ostracon/types"
)
const (
	denom        = "stake"
	keyFoo       = "foo"
	keyBar       = "bar"
	fooDenom     = "foot"
	feeDenom     = "feet"
	fee2Denom    = "fee2t"
	keyBaz       = "baz"
	keyVesting   = "vesting"
	keyFooBarBaz = "foobarbaz"
	DenomStake = "stake2"
	DenomLink  = "link"
	UserTina   = "tina"
	UserKevin  = "kevin"
	UserRinah  = "rinah"
	UserBrian  = "brian"
	UserEvelyn = "evelyn"
	UserSam    = "sam"
)
const (
	namePrefix        = "node"
	networkNamePrefix = "line-lfbnode-testnet-"
)
var curPort int32 = 26656
var (
	TotalCoins = sdk.NewCoins(
		sdk.NewCoin(DenomLink, sdk.TokensFromConsensusPower(6000)),
		sdk.NewCoin(DenomStake, sdk.TokensFromConsensusPower(600000000)),
		sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(2000000)),
		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(2000000)),
		sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(2000)),
		sdk.NewCoin(denom, sdk.TokensFromConsensusPower(300)),  
	)
	startCoins = sdk.NewCoins(
		sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(1000000)),
		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(1000000)),
		sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(1000)),
		sdk.NewCoin(denom, sdk.TokensFromConsensusPower(150)),
	)
	vestingCoins = sdk.NewCoins(
		sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(500000)),
	)
	defaultCoins = sdk.NewCoins(
		sdk.NewCoin(DenomLink, sdk.TokensFromConsensusPower(1000)),
		sdk.NewCoin(DenomStake, sdk.TokensFromConsensusPower(100000000)),
	)
	ostraconCmd = &cobra.Command{
		Use:   "ostracon",
		Short: "Ostracon subcommands",
	}
)
func init() {
	testnet := false
	config := sdk.GetConfig()
	config.SetBech32PrefixForAccount(lfbtypes.Bech32PrefixAcc(testnet), lfbtypes.Bech32PrefixAccPub(testnet))
	config.SetBech32PrefixForValidator(lfbtypes.Bech32PrefixValAddr(testnet), lfbtypes.Bech32PrefixValPub(testnet))
	config.SetBech32PrefixForConsensusNode(lfbtypes.Bech32PrefixConsAddr(testnet), lfbtypes.Bech32PrefixConsPub(testnet))
	config.SetCoinType(lfbtypes.CoinType)
	config.SetFullFundraiserPath(lfbtypes.FullFundraiserPath)
	config.Seal()
	ostraconCmd.AddCommand(
		server.ShowNodeIDCmd(),
		server.ShowValidatorCmd(),
		server.ShowAddressCmd(),
		server.VersionCmd(),
	)
}
type Fixtures struct {
	ChainID  string
	RPCAddr  string
	Port     string
	Home     string
	P2PAddr  string
	P2PPort  string
	GRPCAddr string
	GRPCPort string
	TMAddr   string
	TMPort   string
	Moniker  string
	T        *testing.T
}
func getHomeDir(t *testing.T) string {
	tmpDir := path.Join(os.ExpandEnv("$HOME"), ".lfbtest")
	err := os.MkdirAll(tmpDir, os.ModePerm)
	require.NoError(t, err)
	tmpDir, err = ioutil.TempDir(tmpDir, "link_integration_"+strings.Split(t.Name(), "/")[0]+"_")
	require.NoError(t, err)
	return tmpDir
}
func NewFixtures(t *testing.T, homeDir string) *Fixtures {
	if err := os.MkdirAll(filepath.Join(homeDir, "config/"), os.ModePerm); err != nil {
		panic(err)
	}
	servAddr, servPort := newTCPAddr(t)
	p2pAddr, p2pPort := newTCPAddr(t)
	grpcAddr, grpcPort := newGRPCAddr(t)
	return &Fixtures{
		T:        t,
		Home:     homeDir,
		RPCAddr:  servAddr,
		P2PAddr:  p2pAddr,
		Port:     servPort,
		P2PPort:  p2pPort,
		GRPCAddr: grpcAddr,
		GRPCPort: grpcPort,
		Moniker:  "",  
	}
}
func newTCPAddr(t *testing.T) (addr, port string) {
	portI := atomic.AddInt32(&curPort, 1)
	require.Less(t, portI, int32(32768), "A new port should be less than ip_local_port_range.min")
	port = fmt.Sprintf("%d", portI)
	addr = fmt.Sprintf("tcp://0.0.0.0:%s", port)
	return
}
func newGRPCAddr(t *testing.T) (addr, port string) {
	portI := atomic.AddInt32(&curPort, 1)
	require.Less(t, portI, int32(32768), "A new port should be less than ip_local_port_range.min")
	port = fmt.Sprintf("%d", portI)
	addr = fmt.Sprintf("0.0.0.0:%s", port)
	return
}
func (f *Fixtures) LogResult(isSuccess bool, stdOut, stdErr string) {
	if !isSuccess {
		f.T.Error(stdErr)
	} else {
		f.T.Log(stdOut)
	}
}
func (f Fixtures) Clone() *Fixtures {
	newF := NewFixtures(f.T, getHomeDir(f.T))
	newF.ChainID = f.ChainID
	if err := copyDirectory(f.Home, newF.Home); err != nil {
		os.Exit(0)
	}
	return newF
}
func copyDirectory(src, dest string) error {
	cmd := exec.Command("cp", "-r", src, dest)
	return cmd.Start()
}
func (f Fixtures) GenesisFile() string {
	return filepath.Join(f.Home, "config", "genesis.json")
}
func (f Fixtures) PrivValidatorKeyFile() string {
	return filepath.Join(f.Home, "config", "priv_validator_key.json")
}
func (f Fixtures) GenesisState() app.GenesisState {
	genDoc, err := osttypes.GenesisDocFromFile(f.GenesisFile())
	require.NoError(f.T, err)
	var appState app.GenesisState
	require.NoError(f.T, legacy.Cdc.UnmarshalJSON(genDoc.AppState, &appState))
	return appState
}
func InitFixtures(t *testing.T) (f *Fixtures) {
	f = NewFixtures(t, getHomeDir(t))
	f.KeysDelete(keyFoo)
	f.KeysDelete(keyBar)
	f.KeysDelete(keyBaz)
	f.KeysDelete(keyVesting)
	f.KeysDelete(keyFooBarBaz)
	f.KeysAdd(keyFoo)
	f.KeysAdd(keyBar)
	f.KeysAdd(keyBaz)
	f.KeysAdd(keyVesting)
	f.KeysAdd(keyFooBarBaz, "--multisig-threshold=2", fmt.Sprintf(
		"--multisig=%s,%s,%s", keyFoo, keyBar, keyBaz))
	f.KeysDelete(UserTina)
	f.KeysDelete(UserKevin)
	f.KeysDelete(UserRinah)
	f.KeysDelete(UserBrian)
	f.KeysDelete(UserEvelyn)
	f.KeysDelete(UserSam)
	f.KeysAdd(UserTina)
	f.KeysAdd(UserKevin)
	f.KeysAdd(UserRinah)
	f.KeysAdd(UserBrian)
	f.KeysAdd(UserEvelyn)
	f.KeysAdd(UserSam)
	f.LFBInit(keyFoo)
	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins)
	f.AddGenesisAccount(
		f.KeyAddress(keyVesting), startCoins,
		fmt.Sprintf("--vesting-amount=%s", vestingCoins),
		fmt.Sprintf("--vesting-start-time=%d", time.Now().UTC().UnixNano()),
		fmt.Sprintf("--vesting-end-time=%d", time.Now().Add(60*time.Second).UTC().UnixNano()),
	)
	f.AddGenesisAccount(f.KeyAddress(UserTina), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserKevin), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserRinah), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserBrian), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserEvelyn), defaultCoins)
	f.AddGenesisAccount(f.KeyAddress(UserSam), defaultCoins)
	f.GenTx(keyFoo)
	f.CollectGenTxs()
	return f
}
func (f *Fixtures) Cleanup(dirs ...string) {
	clean := append(dirs, f.Home)  
	for _, d := range clean {
		_ = os.RemoveAll(d)
	}
}
func getCliCtx(f *Fixtures) client.Context {
	kb, err := keyring.New(sdk.KeyringServiceName(), "test", f.Home, os.Stdin)
	require.NoError(f.T, err)
	httpClient, err := osthttp.New(f.RPCAddr, "/websocket")
	require.NoError(f.T, err)
	encodingConfig := app.MakeEncodingConfig()
	return client.Context{}.
		WithJSONMarshaler(encodingConfig.Marshaler).
		WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
		WithTxConfig(encodingConfig.TxConfig).
		WithLegacyAmino(encodingConfig.Amino).
		WithAccountRetriever(authtypes.AccountRetriever{}).
		WithBroadcastMode("block").
		WithSkipConfirmation(true).
		WithHomeDir(f.Home).
		WithKeyringDir(f.Home).
		WithKeyring(kb).
		WithChainID(f.ChainID).
		WithNodeURI(f.RPCAddr).
		WithClient(httpClient)
}