Commit 16814194 authored by 张振华's avatar 张振华

update

parent 9e17640c
......@@ -106,12 +106,12 @@ continueBlockNum=12
isValidator=true
rpcAddr="http://localhost:9801"
#shuffleType为1表示使用固定出块顺序,为2表示使用vrf信息进行出块顺序洗牌
shuffleType=1
shuffleType=2
#是否更新topN,如果为true,根据下面几个配置项定期更新topN节点;如果为false,则一直使用初始配置的节点,不关注投票结果
whetherUpdateTopN=false
blockNumToUpdateDelegate=20000
registTopNHeightLimit=100
updateTopNHeightLimit=200
whetherUpdateTopN=true
blockNumToUpdateDelegate=200
registTopNHeightLimit=10
updateTopNHeightLimit=20
[store]
name="kvdb"
......
......@@ -92,8 +92,7 @@ func DposPerf() {
defer q.Close()
defer cs.Close()
defer p2p.Close()
var err error
err = createConn2()
err := createConn2()
for err != nil {
err = createConn2()
}
......@@ -171,6 +170,12 @@ func DposPerf() {
dposClient.csState.SendCBTx(info)
sendCBTx(dposClient.csState, info)
time.Sleep(2 * time.Second)
fmt.Println("=======start GetCBInfoByCircle!=======")
//first time, not hit
dposClient.csState.GetCBInfoByCircle(task.Cycle)
//second time, hit cache
dposClient.csState.GetCBInfoByCircle(task.Cycle)
fmt.Println("=======start SendRegistVrfMTx!=======")
......@@ -240,6 +245,17 @@ func DposPerf() {
} else {
fmt.Println("QueryVrf ok,", vrfInfo.Cycle, "|", len(vrfInfo.M), "|", len(vrfInfo.R), "|", len(vrfInfo.P))
}
fmt.Println("=======start QueryVrfInfos!=======")
var pubkeys [][]byte
pubkeys = append(pubkeys, pubkey)
vrfInfos, err := dposClient.QueryVrfInfos(pubkeys, task.Cycle)
if err != nil || vrfInfos == nil {
fmt.Println("QueryVrf failed")
} else {
fmt.Println("QueryVrf ok,", vrfInfos[0].Cycle, "|", len(vrfInfos[0].M), "|", len(vrfInfos[0].R), "|", len(vrfInfos[0].P))
}
time.Sleep(2 * time.Second)
fmt.Println("=======start SendTopNRegistTx!=======")
......
......@@ -140,7 +140,7 @@ timeoutVoting=3000
timeoutWaitNotify=2000
createEmptyBlocks=false
createEmptyBlocksInterval=0
validatorNodes=["127.0.0.1:36657"]
validatorNodes=["127.0.0.1:36656"]
delegateNum=1
blockInterval=2
continueBlockNum=12
......@@ -403,7 +403,7 @@ func Init() {
func TestParallel(t *testing.T) {
Parallel(func() {
mutx.Lock()
sum += 1
sum ++
mutx.Unlock()
},
func() {
......@@ -455,7 +455,7 @@ func TestNode(t *testing.T) {
fmt.Println("=======start TestNode!=======")
Init()
q1, chain1, s1, mem1, exec1, cs1, p2p1 := initEnvDpos1("chain33.test1.toml")
q2, chain2, s2, mem2, exec2, cs2, p2p2 := initEnvDpos2("chain33.test2.toml")
//q2, chain2, s2, mem2, exec2, cs2, p2p2 := initEnvDpos2("chain33.test2.toml")
defer clearTestData1()
defer chain1.Close()
......@@ -466,13 +466,13 @@ func TestNode(t *testing.T) {
//defer cs1.Close()
defer p2p1.Close()
defer chain2.Close()
defer mem2.Close()
defer exec2.Close()
defer s2.Close()
defer q2.Close()
//defer chain2.Close()
//defer mem2.Close()
//defer exec2.Close()
//defer s2.Close()
//defer q2.Close()
//defer cs2.Close()
defer p2p2.Close()
//defer p2p2.Close()
time.Sleep(2 * time.Second)
......@@ -481,10 +481,10 @@ func TestNode(t *testing.T) {
_, _, err = createConn("127.0.0.1:8802")
}
_, _, err = createConn("127.0.0.1:8804")
for err != nil {
_, _, err = createConn("127.0.0.1:8804")
}
//_, _, err = createConn("127.0.0.1:8804")
//for err != nil {
// _, _, err = createConn("127.0.0.1:8804")
//}
fmt.Println("node1 ip:", cs1.(*Client).GetNode().IP)
fmt.Println("node1 id:", cs1.(*Client).GetNode().ID)
......@@ -499,6 +499,19 @@ func TestNode(t *testing.T) {
}
require.Nil(t, cs1.(*Client).GetNode().CompatibleWith(nodeinfo))
cs1.(*Client).GetNode().Version = "0.1"
require.NotNil(t, cs1.(*Client).GetNode().CompatibleWith(nodeinfo))
cs1.(*Client).GetNode().Version = nodeinfo.Version
nodeinfo.Version = "0.1"
require.NotNil(t, cs1.(*Client).GetNode().CompatibleWith(nodeinfo))
nodeinfo.Version = "1.1.0"
require.NotNil(t, cs1.(*Client).GetNode().CompatibleWith(nodeinfo))
nodeinfo.Version = "0.0.0"
require.Nil(t, cs1.(*Client).GetNode().CompatibleWith(nodeinfo))
nodeinfo.Version = cs1.(*Client).GetNode().Version
nodeinfo.Network = "chain33-Z2cgFi"
require.NotNil(t, cs1.(*Client).GetNode().CompatibleWith(nodeinfo))
fmt.Println("TestNodeCompatibleWith ok")
//time.Sleep(2 * time.Second)
......@@ -532,15 +545,6 @@ func TestNode(t *testing.T) {
fmt.Println("======= cs1 is not running=======")
}
//cs2.(*Client).StopC()
if cs2.(*Client).GetNode().IsRunning() {
fmt.Println("=======cs2 is running=======")
//cs2.(*Client).GetConsensusState().Stop()
//cs2.(*Client).GetNode().Stop()
} else {
fmt.Println("======= cs2 is not running=======")
}
fmt.Println("=======testNode ok=======")
}
......
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