Commit 30cce928 authored by caopingcp's avatar caopingcp

Merge branch 'master' into 'issue615_tendermint'

parents 9bceceab a413a97a
......@@ -10,6 +10,7 @@ datadir*
build/chain33*
chain33_raft-1
build/datadir
build/fork-config
build/bityuan*
build/para
build/cli
......
......@@ -36,7 +36,8 @@ dbCache=64
isStrongConsistency=true
singleMode=true
batchsync=false
isRecordBlockSequence=false
#平行链钱包通过平行链区块seqence索引高度,缺省是true
isRecordBlockSequence=true
isParaChain = true
enableTxQuickIndex=true
# 升级storedb是否重新执行localdb,bityuan主链升级不需要开启,平行链升级需要开启
......@@ -99,8 +100,6 @@ startHeight=345850
writeBlockSeconds=2
#验证账户,验证节点需要配置自己的账户,并且钱包导入对应种子,非验证节点留空
authAccount=""
#云端主链节点切换后,平行链适配新主链节点block,回溯查找和自己记录的相同blockhash的深度
searchHashMatchedBlockDepth=10000
#创世地址额度
genesisAmount=100000000
#主链支持平行链共识tx分叉高度,需要和主链保持严格一致,不可修改,2270000是bityuan主链对应高度, ycc或其他按实际修改
......@@ -140,7 +139,9 @@ enableMVCCIter=true
enableMavlPrefix=false
enableMVCC=false
enableMavlPrune=false
pruneHeight=10000
pruneMavlHeight=10000
enableMVCCPrune=false
pruneMVCCHeight=10000
# 是否使能mavl数据载入内存
enableMemTree=true
# 是否使能mavl叶子节点数据载入内存
......
......@@ -171,7 +171,9 @@ enableMVCCIter=true
enableMavlPrefix=false
enableMVCC=false
enableMavlPrune=false
pruneHeight=10000
pruneMavlHeight=10000
enableMVCCPrune=false
pruneMVCCHeight=10000
# 是否使能mavl数据载入内存
enableMemTree=true
# 是否使能mavl叶子节点数据载入内存
......
......@@ -11,12 +11,12 @@ require (
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d // indirect
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
github.com/coreos/etcd v3.3.13+incompatible
github.com/coreos/etcd v3.3.15+incompatible
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
github.com/davecgh/go-spew v1.1.1
github.com/gogo/protobuf v1.2.1
github.com/gogo/protobuf v1.3.0
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/protobuf v1.3.2
github.com/hashicorp/golang-lru v0.5.0
......@@ -29,11 +29,14 @@ require (
github.com/spf13/cobra v0.0.3
github.com/stretchr/testify v1.3.0
github.com/tjfoc/gmsm v0.0.0-20171124023159-98aa888b79d8
github.com/valyala/fasthttp v1.4.0
github.com/valyala/fasthttp v1.5.0
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/multierr v1.2.0 // indirect
go.uber.org/zap v1.10.0 // indirect
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect
google.golang.org/grpc v1.22.1
gopkg.in/sourcemap.v1 v1.0.5 // indirect
)
This diff is collapsed.
......@@ -11,7 +11,6 @@ import (
"os"
"path/filepath"
"sync"
"syscall"
"time"
)
......@@ -88,50 +87,12 @@ func Fingerprint(slice []byte) []byte {
return fingerprint
}
// Kill ...
func Kill() error {
p, err := os.FindProcess(os.Getpid())
if err != nil {
return err
}
return p.Signal(syscall.SIGTERM)
}
// Exit ...
func Exit(s string) {
fmt.Printf(s + "\n")
os.Exit(1)
}
// Parallel ...
func Parallel(tasks ...func()) {
var wg sync.WaitGroup
wg.Add(len(tasks))
for _, task := range tasks {
go func(task func()) {
task()
wg.Done()
}(task)
}
wg.Wait()
}
// MinInt ...
func MinInt(a, b int) int {
if a < b {
return a
}
return b
}
// MaxInt ...
func MaxInt(a, b int) int {
if a > b {
return a
}
return b
}
// RandIntn ...
func RandIntn(n int) int {
if n <= 0 {
......
......@@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"os"
"os/signal"
"strings"
"sync"
"testing"
......@@ -83,14 +82,6 @@ func TestFingerprint(t *testing.T) {
assert.True(t, bytes.Equal(finger, arr[0:6]))
}
func TestKill(t *testing.T) {
c := make(chan os.Signal)
signal.Notify(c)
go Kill()
s := <-c
assert.True(t, s.String() == "terminated")
}
var (
goIndex = 0
goIndexMutex sync.Mutex
......@@ -116,17 +107,6 @@ func TestParallel(t *testing.T) {
f2 := test
f2()
assert.True(t, goSum == 2)
/*
goSumMutex.Lock()
goSum = 0
goSumMutex.Unlock()
Parallel(f1, f2)
goSumMutex.Lock()
assert.True(t, goSum == 2)
goSumMutex.Unlock()
*/
}
func TestRandInt63n(t *testing.T) {
......
......@@ -40,7 +40,6 @@ const (
defaultSearchMatchedBlockDepth int32 = 10000
defaultMainBlockHashForkHeight int64 = 209186 //calc block hash fork height in main chain
mainParaSelfConsensusForkHeight int64 = types.MaxHeight //para chain self consensus height switch, must >= ForkParacrossCommitTx of main
mainForkParacrossCommitTx int64 = types.MaxHeight //support paracross commit tx fork height in main chain: ForkParacrossCommitTx
)
var (
......@@ -78,18 +77,17 @@ type subConfig struct {
WriteBlockSeconds int64 `json:"writeBlockSeconds,omitempty"`
ParaRemoteGrpcClient string `json:"paraRemoteGrpcClient,omitempty"`
StartHeight int64 `json:"startHeight,omitempty"`
GenesisStartHeightSame bool `json:"genesisStartHeightSame,omitempty"`
EmptyBlockInterval []*emptyBlockInterval `json:"emptyBlockInterval,omitempty"`
AuthAccount string `json:"authAccount,omitempty"`
WaitBlocks4CommitMsg int32 `json:"waitBlocks4CommitMsg,omitempty"`
SearchHashMatchedBlockDepth int32 `json:"searchHashMatchedBlockDepth,omitempty"`
GenesisAmount int64 `json:"genesisAmount,omitempty"`
MainBlockHashForkHeight int64 `json:"mainBlockHashForkHeight,omitempty"`
MainParaSelfConsensusForkHeight int64 `json:"mainParaSelfConsensusForkHeight,omitempty"`
MainForkParacrossCommitTx int64 `json:"mainForkParacrossCommitTx,omitempty"`
WaitConsensStopTimes uint32 `json:"waitConsensStopTimes,omitempty"`
MaxCacheCount int64 `json:"maxCacheCount,omitempty"`
MaxSyncErrCount int32 `json:"maxSyncErrCount,omitempty"`
FetchFilterParaTxsEnable bool `json:"fetchFilterParaTxsEnable,omitempty"`
FetchFilterParaTxsClose bool `json:"fetchFilterParaTxsClose,omitempty"`
BatchFetchBlockCount int64 `json:"batchFetchBlockCount,omitempty"`
ParaConsensStartHeight int64 `json:"paraConsensStartHeight,omitempty"`
MultiDownloadOpen bool `json:"multiDownloadOpen,omitempty"`
......@@ -121,9 +119,6 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
panic("para EmptyBlockInterval config not correct")
}
if subcfg.SearchHashMatchedBlockDepth <= 0 {
subcfg.SearchHashMatchedBlockDepth = defaultSearchMatchedBlockDepth
}
if subcfg.MainBlockHashForkHeight <= 0 {
subcfg.MainBlockHashForkHeight = defaultMainBlockHashForkHeight
}
......@@ -132,10 +127,6 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
subcfg.MainParaSelfConsensusForkHeight = mainParaSelfConsensusForkHeight
}
if subcfg.MainForkParacrossCommitTx <= 0 {
subcfg.MainForkParacrossCommitTx = mainForkParacrossCommitTx
}
if subcfg.BatchFetchBlockCount <= 0 {
subcfg.BatchFetchBlockCount = types.MaxBlockCountPerTime
}
......@@ -304,7 +295,12 @@ func (client *client) InitBlock() {
newblock.BlockTime = genesisBlockTime
newblock.ParentHash = zeroHash[:]
newblock.MainHash = mainHash
//缺省是减1,但有些特殊项目方6.2.0版本升级上来要求blockhash不变,则需与6.2.0保持一致,不减一
newblock.MainHeight = client.subCfg.StartHeight - 1
if client.subCfg.GenesisStartHeightSame {
newblock.MainHeight = client.subCfg.StartHeight
}
tx := client.CreateGenesisTx()
newblock.Txs = tx
newblock.TxHash = merkle.CalcMerkleRoot(newblock.Txs)
......@@ -322,7 +318,6 @@ func (client *client) InitBlock() {
}
plog.Debug("para consensus init parameter", "mainBlockHashForkHeight", client.subCfg.MainBlockHashForkHeight)
plog.Debug("para consensus init parameter", "mainParaSelfConsensusForkHeight", client.subCfg.MainParaSelfConsensusForkHeight)
}
......
......@@ -213,7 +213,7 @@ func (client *client) getMatchedBlockOnChain(startHeight int64) (int64, *types.B
startHeight = lastBlock.Height
}
depth := client.subCfg.SearchHashMatchedBlockDepth
depth := defaultSearchMatchedBlockDepth
for height := startHeight; height > 0 && depth > 0; height-- {
block, err := client.GetBlockByHeight(height)
if err != nil {
......@@ -228,7 +228,7 @@ func (client *client) getMatchedBlockOnChain(startHeight int64) (int64, *types.B
if depth == 0 {
plog.Error("switchHashMatchedBlock depth overflow", "last info:mainHeight", block.MainHeight,
"mainHash", hex.EncodeToString(block.MainHash), "search startHeight", lastBlock.Height, "curHeight", height,
"search depth", client.subCfg.SearchHashMatchedBlockDepth)
"search depth", defaultSearchMatchedBlockDepth)
panic("search HashMatchedBlock overflow, re-setting search depth and restart to try")
}
if height == 1 {
......@@ -318,7 +318,7 @@ func (client *client) getBatchSeqCount(currSeq int64) (int64, error) {
} else {
atomic.StoreInt32(&client.caughtUp, 1)
}
if client.subCfg.FetchFilterParaTxsEnable && lastSeq-currSeq > client.subCfg.BatchFetchBlockCount {
if !client.subCfg.FetchFilterParaTxsClose && lastSeq-currSeq > client.subCfg.BatchFetchBlockCount {
return client.subCfg.BatchFetchBlockCount - 1, nil
}
return 0, nil
......@@ -432,7 +432,7 @@ func (client *client) requestFilterParaTxs(currSeq int64, count int64, preMainBl
}
func (client *client) RequestTx(currSeq int64, count int64, preMainBlockHash []byte) (*types.ParaTxDetails, error) {
if client.subCfg.FetchFilterParaTxsEnable {
if !client.subCfg.FetchFilterParaTxsClose {
return client.requestFilterParaTxs(currSeq, count, preMainBlockHash)
}
......
......@@ -155,6 +155,7 @@ func (m *multiDldClient) getConns(inv *inventory) error {
return nil
}
//缺省不打开,因为有些节点下载时间不稳定,容易超时出错,后面看怎么优化
func (m *multiDldClient) tryMultiServerDownload() {
if !m.paraClient.subCfg.MultiDownloadOpen {
return
......
......@@ -84,6 +84,8 @@ func serveHTTPRaftAPI(ctx context.Context, port int, confChangeC chan<- raftpb.C
srv.Close()
case err := <-errorC:
srv.Close()
rlog.Error(fmt.Sprintf("the errorC chan receive a err (%v)\n", err.Error()))
if err != nil {
rlog.Error(fmt.Sprintf("the errorC chan receive a err (%v)\n", err.Error()))
}
}
}
......@@ -8,7 +8,6 @@ import (
"github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/autonomy/commands"
"github.com/33cn/plugin/plugin/dapp/autonomy/executor"
"github.com/33cn/plugin/plugin/dapp/autonomy/rpc"
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
......@@ -18,6 +17,5 @@ func init() {
ExecName: executor.GetName(),
Exec: executor.Init,
Cmd: commands.AutonomyCmd,
RPC: rpc.Init,
})
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpc
import (
"github.com/33cn/chain33/rpc/types"
)
// Jrpc json rpc struct
type Jrpc struct {
cli *channelClient
}
// Grpc grpc struct
type Grpc struct {
*channelClient
}
type channelClient struct {
types.ChannelClient
}
// Init init grpc param
func Init(name string, s types.RPCServer) {
cli := &channelClient{}
grpc := &Grpc{channelClient: cli}
cli.Init(name, s, &Jrpc{cli: cli}, grpc)
}
......@@ -47,7 +47,7 @@ func checkReceiptExecOk(receipt *types.ReceiptData) bool {
// 1, 主链+平行链 user.p.xx.paracross 交易组 混合跨链资产转移 paracross主链执行成功
// 2, 平行链 user.p.xx.paracross + user.p.xx.other 混合平行链组合 paracross主链执行成功
// 3, 平行链 user.p.xx.other 交易组 混合平行链组合 other主链pack
func filterParaTxGroup(tx *types.Transaction, allTxs []*types.TxDetail, index int, blockHeight, forkHeight int64) ([]*types.Transaction, int) {
func filterParaTxGroup(tx *types.Transaction, allTxs []*types.TxDetail, index int, mainBlockHeight, forkHeight int64) ([]*types.Transaction, int) {
var headIdx int
for i := index; i >= 0; i-- {
......@@ -59,7 +59,8 @@ func filterParaTxGroup(tx *types.Transaction, allTxs []*types.TxDetail, index in
endIdx := headIdx + int(tx.GroupCount)
for i := headIdx; i < endIdx; i++ {
if types.IsPara() && blockHeight < forkHeight {
//缺省是在forkHeight之前与更老版本一致,不检查平行链交易,但有些特殊平行链6.2.0版本升级上来无更老版本且要求blockhash不变,则需与6.2.0保持一致,不检查
if types.IsPara() && mainBlockHeight < forkHeight && !types.Conf("config.consensus.sub.para").IsEnable("FilterIgnoreParaTxGroup") {
if types.IsParaExecName(string(allTxs[i].Tx.Execer)) {
continue
}
......
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpc_test
import (
"strings"
"testing"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
_ "github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
_ "github.com/33cn/plugin/plugin"
"github.com/stretchr/testify/assert"
)
var mocker *testnode.Chain33Mock
func TestMain(m *testing.M) {
cfg, sub := testnode.GetDefaultConfig()
cfg.Consensus.Name = "ticket"
mocker = testnode.NewWithConfig(cfg, sub, nil)
mocker.Listen()
m.Run()
mocker.Close()
}
func TestJRPCChannel(t *testing.T) {
jrpcClient := mocker.GetJSONC()
testCases := []struct {
fn func(*testing.T, *jsonclient.JSONClient) error
}{
{fn: testCountTicketCmd},
{fn: testCloseTicketCmd},
{fn: testGetColdAddrByMinerCmd},
}
for index, testCase := range testCases {
err := testCase.fn(t, jrpcClient)
if err == nil {
continue
}
assert.NotEqualf(t, err, types.ErrActionNotSupport, "test index %d", index)
if strings.Contains(err.Error(), "rpc: can't find") {
assert.FailNowf(t, err.Error(), "test index %d", index)
}
t.Log(err.Error())
}
}
func testCountTicketCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
var res int64
return jrpc.Call("ticket.GetTicketCount", nil, &res)
}
func testCloseTicketCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
var res types.ReplyHashes
return jrpc.Call("ticket.CloseTickets", nil, &res)
}
func testGetColdAddrByMinerCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
var rep interface{}
var params rpctypes.Query4Jrpc
req := &types.ReqString{}
params.Execer = "ticket"
params.FuncName = "MinerSourceList"
params.Payload = types.MustPBToJSON(req)
rep = &types.ReplyStrings{}
return jrpc.Call("Chain33.Query", params, rep)
}
......@@ -42,6 +42,10 @@ func (g *channelClient) CreateBindMiner(ctx context.Context, in *ty.ReqBindMiner
if err != nil {
return nil, err
}
price := ty.GetTicketMinerParam(header.Height).TicketPrice
if price == 0 {
return nil, types.ErrInvalidParam
}
if in.Amount%ty.GetTicketMinerParam(header.Height).TicketPrice != 0 || in.Amount < 0 {
return nil, types.ErrAmount
}
......
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpc_test
//only load all plugin and system
import (
"testing"
rpctypes "github.com/33cn/chain33/rpc/types"
_ "github.com/33cn/chain33/system"
_ "github.com/33cn/plugin/plugin"
ty "github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/stretchr/testify/assert"
)
func TestNewTicket(t *testing.T) {
//选票(可以用hotwallet 关闭选票)
in := &ty.TicketClose{MinerAddress: mocker.GetHotAddress()}
var res rpctypes.ReplyHashes
err := mocker.GetJSONC().Call("ticket.CloseTickets", in, &res)
assert.Nil(t, err)
}
......@@ -23,88 +23,6 @@ import (
"google.golang.org/grpc"
)
var cfgstring = `
Title="test"
[mempool]
poolCacheSize=102400
minTxFee=100000
maxTxNumPerAccount=100
[exec]
isFree=false
minExecFee=100000
enableStat=false
enableMVCC=false
[wallet]
minFee=100000
driver="leveldb"
dbPath="wallet"
dbCache=16
signType="secp256k1"
minerdisable=false
minerwhitelist=["*"]
[mver.consensus]
fundKeyAddr = "1BQXS6TxaYYG5mADaWij4AxhZZUTpw95a5"
powLimitBits = "0x1f00ffff"
maxTxNumber = 10000
[mver.consensus.ticket]
coinReward = 18
coinDevFund = 12
ticketPrice = 10000
retargetAdjustmentFactor = 4
futureBlockTime = 16
ticketFrozenTime = 5
ticketWithdrawTime = 10
ticketMinerWaitTime = 2
targetTimespan = 2304
targetTimePerBlock = 16
[mver.consensus.ticket.ForkChainParamV1]
ticketPrice = 3000
[mver.consensus.ticket.ForkChainParamV2]
ticketPrice = 6000
[fork.system]
ForkChainParamV1= 10
ForkChainParamV2= 20
ForkStateDBSet=-1
ForkCheckTxDup=0
ForkBlockHash= 1
ForkMinerTime= 10
ForkTransferExec= 100000
ForkExecKey= 200000
ForkTxGroup= 200000
ForkResetTx0= 200000
ForkWithdraw= 200000
ForkExecRollback= 450000
ForkTxHeight= -1
ForkTxGroupPara= -1
ForkCheckBlockTime=1200000
ForkMultiSignAddress=1298600
ForkBlockCheck=1
ForkLocalDBAccess=0
ForkBase58AddressCheck=1800000
ForkEnableParaRegExec=0
ForkCacheDriver=0
ForkTicketFundAddrV1=-1
[fork.sub.coins]
Enable=0
[fork.sub.manage]
Enable=0
ForkManageExec=100000
[fork.sub.store-kvmvccmavl]
ForkKvmvccmavl=1
`
func newGrpc(api client.QueueProtocolAPI) *channelClient {
return &channelClient{
ChannelClient: rpctypes.ChannelClient{QueueProtocolAPI: api},
......@@ -128,30 +46,16 @@ func TestChannelClient_BindMiner(t *testing.T) {
storevalue.Values = append(storevalue.Values, accv)
api.On("StoreGet", mock.Anything).Return(storevalue, nil).Twice()
types.SetTitleOnlyForTest("test")
cfg, _ := types.InitCfgString(cfgstring)
types.Init("test", cfg)
//var addrs = make([]string, 1)
//addrs = append(addrs, "1Jn2qu84Z1SUUosWjySggBS9pKWdAP3tZt")
var in = &ty.ReqBindMiner{
BindAddr: "1Jn2qu84Z1SUUosWjySggBS9pKWdAP3tZt",
OriginAddr: "1Jn2qu84Z1SUUosWjySggBS9pKWdAP3tZt",
Amount: 10000 * types.Coin,
CheckBalance: true,
CheckBalance: false,
}
_, err := client.CreateBindMiner(context.Background(), in)
assert.Nil(t, err)
in.Amount = 200000 * types.Coin
_, err = client.CreateBindMiner(context.Background(), in)
assert.Equal(t, types.ErrNoBalance, err)
head.Height = 20 //ForkChainParamV2
api.On("GetLastHeader").Return(head, nil).Times(2)
_, err = client.CreateBindMiner(context.Background(), in)
assert.Equal(t, types.ErrAmount, err)
}
func testGetTicketCountOK(t *testing.T) {
......
......@@ -74,7 +74,7 @@ type KVmMavlStore struct {
type subKVMVCCConfig struct {
EnableMVCCIter bool `json:"enableMVCCIter"`
EnableMavlPrune bool `json:"enableMavlPrune"`
EnableMVCCPrune bool `json:"enableMVCCPrune"`
PruneHeight int32 `json:"pruneHeight"`
}
......@@ -96,7 +96,9 @@ type subConfig struct {
EnableMavlPrefix bool `json:"enableMavlPrefix"`
EnableMVCC bool `json:"enableMVCC"`
EnableMavlPrune bool `json:"enableMavlPrune"`
PruneHeight int32 `json:"pruneHeight"`
PruneMavlHeight int32 `json:"pruneMavlHeight"`
EnableMVCCPrune bool `json:"enableMVCCPrune"`
PruneMVCCHeight int32 `json:"pruneMVCCHeight"`
// 是否使能内存树
EnableMemTree bool `json:"enableMemTree"`
// 是否使能内存树中叶子节点
......@@ -114,13 +116,13 @@ func New(cfg *types.Store, sub []byte) queue.Module {
if sub != nil {
types.MustDecode(sub, &subcfg)
subKVMVCCcfg.EnableMVCCIter = subcfg.EnableMVCCIter
subKVMVCCcfg.EnableMavlPrune = subcfg.EnableMavlPrune
subKVMVCCcfg.PruneHeight = subcfg.PruneHeight
subKVMVCCcfg.EnableMVCCPrune = subcfg.EnableMVCCPrune
subKVMVCCcfg.PruneHeight = subcfg.PruneMVCCHeight
subMavlcfg.EnableMavlPrefix = subcfg.EnableMavlPrefix
subMavlcfg.EnableMVCC = subcfg.EnableMVCC
subMavlcfg.EnableMavlPrune = subcfg.EnableMavlPrune
subMavlcfg.PruneHeight = subcfg.PruneHeight
subMavlcfg.PruneHeight = subcfg.PruneMavlHeight
subMavlcfg.EnableMemTree = subcfg.EnableMemTree
subMavlcfg.EnableMemVal = subcfg.EnableMemVal
subMavlcfg.TkCloseCacheLen = subcfg.TkCloseCacheLen
......
......@@ -52,7 +52,7 @@ type KVMVCCStore struct {
mvcc dbm.MVCC
kvsetmap map[string][]*types.KeyValue
enableMVCCIter bool
enableMavlPrune bool
enableMVCCPrune bool
pruneHeight int32
sync bool
}
......@@ -66,12 +66,12 @@ func NewKVMVCC(sub *subKVMVCCConfig, db dbm.DB) *KVMVCCStore {
}
if enable {
kvs = &KVMVCCStore{db, dbm.NewMVCCIter(db), make(map[string][]*types.KeyValue),
true, sub.EnableMavlPrune, sub.PruneHeight, false}
true, sub.EnableMVCCPrune, sub.PruneHeight, false}
} else {
kvs = &KVMVCCStore{db, dbm.NewMVCC(db), make(map[string][]*types.KeyValue),
false, sub.EnableMavlPrune, sub.PruneHeight, false}
false, sub.EnableMVCCPrune, sub.PruneHeight, false}
}
EnablePrune(sub.EnableMavlPrune)
EnablePrune(sub.EnableMVCCPrune)
SetPruneHeight(int(sub.PruneHeight))
return kvs
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment