Commit 07dcb5cb authored by liuyuhang's avatar liuyuhang

merge master

parent 3b38b667
......@@ -4,41 +4,78 @@ go 1.12
require (
github.com/33cn/chain33 v0.0.0-20191017025459-6d5c61c7d134
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/entropy-mnemonics v0.0.0-20170316012907-7b01a644a636
github.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8
github.com/NebulousLabs/fastrand v0.0.0-20180208210444-3cf7173006a0
github.com/NebulousLabs/merkletree v0.0.0-20181025040823-2a1d1d1dc33c
github.com/XiaoMi/pegasus-go-client v0.0.0-20181029071519-9400942c5d1c
github.com/apache/thrift v0.0.0-20171203172758-327ebb6c2b6d
github.com/beorn7/perks v1.0.1
github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
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/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792
github.com/coreos/bbolt v1.3.0
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/coreos/go-semver v0.3.0
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
github.com/davecgh/go-spew v1.1.1
github.com/dchest/blake256 v1.0.0
github.com/decred/base58 v1.0.0
github.com/dgraph-io/badger v1.5.4
github.com/dgryski/go-farm v0.0.0-20180109070241-2de33835d102
github.com/go-stack/stack v1.8.0
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/golang/snappy v0.0.0-20180518054509-2e65f85255db
github.com/haltingstate/secp256k1-go v0.0.0-20151224084235-572209b26df6
github.com/hashicorp/golang-lru v0.5.0
github.com/huin/goupnp v1.0.0
github.com/inconshreveable/mousetrap v1.0.0
github.com/jackpal/go-nat-pmp v1.0.1
github.com/klauspost/compress v1.8.2
github.com/klauspost/cpuid v1.2.1
github.com/mattn/go-colorable v0.0.9
github.com/mattn/go-isatty v0.0.4
github.com/matttproud/golang_protobuf_extensions v1.0.1
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/mr-tron/base58 v1.1.0
github.com/pkg/errors v0.8.0
github.com/prometheus/client_golang v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v1.1.0
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
github.com/prometheus/common v0.6.0
github.com/prometheus/procfs v0.0.3
github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d
github.com/rs/cors v1.6.0
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3
github.com/stretchr/objx v0.1.1
github.com/stretchr/testify v1.3.0
github.com/syndtr/goleveldb v0.0.0-20181105012736-f9080354173f
github.com/tjfoc/gmsm v0.0.0-20171124023159-98aa888b79d8
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
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2
go.uber.org/atomic v1.4.0
go.uber.org/multierr v1.2.0
go.uber.org/zap v1.10.0
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
golang.org/x/text v0.3.2
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
google.golang.org/grpc v1.22.1
gopkg.in/sourcemap.v1 v1.0.5 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3
gopkg.in/sourcemap.v1 v1.0.5
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
)
replace github.com/33cn/chain33 => github.com/lyh169/chain33 v0.0.0-20191017080109-0e21124b01fc
replace github.com/33cn/chain33 => github.com/lyh169/chain33 v0.0.0-20191021072850-f71d3eddca4a
......@@ -124,6 +124,8 @@ github.com/lyh169/chain33 v0.0.0-20191012060858-1e258d8cc3bf h1:TXOjG6jLLFCjSZoK
github.com/lyh169/chain33 v0.0.0-20191012060858-1e258d8cc3bf/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
github.com/lyh169/chain33 v0.0.0-20191017080109-0e21124b01fc h1:X9d9RvQaECoqK1jWhSUzjcMa77Xxed1a50p9uWSYoQ4=
github.com/lyh169/chain33 v0.0.0-20191017080109-0e21124b01fc/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
github.com/lyh169/chain33 v0.0.0-20191021072850-f71d3eddca4a h1:m4xrIrvYN8pe3aASOxNpSvFOsZA7Fy+KKLmN8gRugkA=
github.com/lyh169/chain33 v0.0.0-20191021072850-f71d3eddca4a/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
......
......@@ -820,7 +820,8 @@ func (cs *ConsensusState) defaultDoPrevote(height int64, round int) {
cs.signAddVote(ttypes.VoteTypePrevote, nil)
return
}
if !bytes.Equal(blockNew.Hash(), cs.ProposalBlock.Data.Hash()) {
cfg := cs.client.GetQueueClient().GetConfig()
if !bytes.Equal(blockNew.Hash(cfg), cs.ProposalBlock.Data.Hash(cfg)) {
tendermintlog.Error("enterPrevote: PreExec ProposalBlock has change")
cs.signAddVote(ttypes.VoteTypePrevote, nil)
return
......
......@@ -365,6 +365,7 @@ func TestGuess(t *testing.T) {
func testGuessImp(t *testing.T) {
fmt.Println("=======start guess test!=======")
q, chain, s, mem, exec, cs, p2p, cmd := initEnvGuess()
cfg := q.GetConfig()
defer chain.Close()
defer mem.Close()
defer exec.Close()
......@@ -386,8 +387,8 @@ func testGuessImp(t *testing.T) {
fmt.Println("=======start sendTransferTx sendTransferToExecTx!=======")
//从创世地址向测试地址A转入代币
sendTransferTx(adminPriv, userAAddr, 2000000000000)
sendTransferTx(adminPriv, userBAddr, 2000000000000)
sendTransferTx(cfg, adminPriv, userAAddr, 2000000000000)
sendTransferTx(cfg, adminPriv, userBAddr, 2000000000000)
time.Sleep(2 * time.Second)
in := &types.ReqBalance{}
......@@ -411,8 +412,8 @@ func testGuessImp(t *testing.T) {
assert.Equal(t, true, acct2.Acc[0].Balance == 2000000000000)
//从测试地址向dos合约转入代币
sendTransferToExecTx(userAPriv, "guess", 1000000000000)
sendTransferToExecTx(userBPriv, "guess", 1000000000000)
sendTransferToExecTx(cfg, userAPriv, "guess", 1000000000000)
sendTransferToExecTx(cfg, userBPriv, "guess", 1000000000000)
time.Sleep(2 * time.Second)
fmt.Println("=======start GetBalance!=======")
......@@ -441,25 +442,28 @@ func testGuessImp(t *testing.T) {
}
func initEnvGuess() (queue.Queue, *blockchain.BlockChain, queue.Module, queue.Module, *executor.Executor, queue.Module, queue.Module, *cobra.Command) {
var q = queue.New("channel")
flag.Parse()
cfg, sub := types.InitCfg("chain33.test.toml")
types.Init(cfg.Title, cfg)
chain := blockchain.New(cfg.BlockChain)
chain33Cfg := types.NewChain33Config(types.ReadFile("chain33.test.toml"))
var q = queue.New("channel")
q.SetConfig(chain33Cfg)
cfg := chain33Cfg.GetModuleConfig()
sub := chain33Cfg.GetSubConfig()
chain := blockchain.New(chain33Cfg)
chain.SetQueueClient(q.Client())
exec := executor.New(cfg.Exec, sub.Exec)
exec := executor.New(chain33Cfg)
exec.SetQueueClient(q.Client())
types.SetMinFee(0)
s := store.New(cfg.Store, sub.Store)
chain33Cfg.SetMinFee(0)
s := store.New(chain33Cfg)
s.SetQueueClient(q.Client())
cs := solo.New(cfg.Consensus, sub.Consensus["solo"])
cs.SetQueueClient(q.Client())
mem := mempool.New(cfg.Mempool, nil)
mem := mempool.New(chain33Cfg)
mem.SetQueueClient(q.Client())
network := p2p.New(cfg.P2P)
network := p2p.New(chain33Cfg)
network.SetQueueClient(q.Client())
......@@ -550,7 +554,7 @@ func NormPut() {
}
}
func sendTransferTx(fromKey, to string, amount int64) bool {
func sendTransferTx(cfg *types.Chain33Config, fromKey, to string, amount int64) bool {
signer := util.HexToPrivkey(fromKey)
var tx *types.Transaction
transfer := &cty.CoinsAction{}
......@@ -559,7 +563,7 @@ func sendTransferTx(fromKey, to string, amount int64) bool {
transfer.Ty = cty.CoinsActionTransfer
execer := []byte("coins")
tx = &types.Transaction{Execer: execer, Payload: types.Encode(transfer), To: to, Fee: fee}
tx, err := types.FormatTx(string(execer), tx)
tx, err := types.FormatTx(cfg, string(execer), tx)
if err != nil {
fmt.Println("in sendTransferTx formatTx failed")
return false
......@@ -584,7 +588,7 @@ func sendTransferTx(fromKey, to string, amount int64) bool {
return true
}
func sendTransferToExecTx(fromKey, execName string, amount int64) bool {
func sendTransferToExecTx(cfg *types.Chain33Config, fromKey, execName string, amount int64) bool {
signer := util.HexToPrivkey(fromKey)
var tx *types.Transaction
transfer := &cty.CoinsAction{}
......@@ -594,7 +598,7 @@ func sendTransferToExecTx(fromKey, execName string, amount int64) bool {
transfer.Ty = cty.CoinsActionTransferToExec
execer := []byte("coins")
tx = &types.Transaction{Execer: execer, Payload: types.Encode(transfer), To: address.ExecAddress("guess"), Fee: fee}
tx, err := types.FormatTx(string(execer), tx)
tx, err := types.FormatTx(cfg, string(execer), tx)
if err != nil {
fmt.Println("sendTransferToExecTx formatTx failed.")
......@@ -627,6 +631,11 @@ func testCmd(cmd *cobra.Command) {
Short: "chain33 client tools",
}
chain33Cfg := types.NewChain33Config(types.ReadFile("chain33.test.toml"))
types.SetCliSysParam(chain33Cfg.GetTitle(), chain33Cfg)
rootCmd.PersistentFlags().String("title", chain33Cfg.GetTitle(), "get title name")
rootCmd.PersistentFlags().String("rpc_laddr", "http://127.0.0.1:8802", "http url")
rootCmd.AddCommand(cmd)
......
This diff is collapsed.
......@@ -193,3 +193,85 @@ func TestRPC_CallTestNode(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, r.IsOk, true)
}
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
`
\ No newline at end of file
......@@ -306,6 +306,7 @@ func (mvccs *KVMVCCStore) checkVersion(height int64) ([]*types.KeyValue, error)
panic(err)
} else {
maxVersion = -1
kmlog.Error("store kvmvcc checkVersion GetMaxVersion failed", "err", err, "maxVersion", maxVersion)
}
}
......
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