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

Merge branch 'dpos-v2' of https://github.com/zzh33cn/plugin into dpos-v2

parents cfafdcc5 4b0d5e13
...@@ -30,10 +30,9 @@ import ( ...@@ -30,10 +30,9 @@ import (
"github.com/33cn/chain33/store" "github.com/33cn/chain33/store"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types" ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
dty "github.com/33cn/plugin/plugin/dapp/dposvote/types"
pty "github.com/33cn/plugin/plugin/dapp/norm/types" pty "github.com/33cn/plugin/plugin/dapp/norm/types"
"google.golang.org/grpc" "google.golang.org/grpc"
dty "github.com/33cn/plugin/plugin/dapp/dposvote/types"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
_ "github.com/33cn/plugin/plugin/dapp/init" _ "github.com/33cn/plugin/plugin/dapp/init"
...@@ -46,7 +45,7 @@ var ( ...@@ -46,7 +45,7 @@ var (
conn *grpc.ClientConn conn *grpc.ClientConn
c types.Chain33Client c types.Chain33Client
strPubkey = "03EF0E1D3112CF571743A3318125EDE2E52A4EB904BCBAA4B1F75020C2846A7EB4" strPubkey = "03EF0E1D3112CF571743A3318125EDE2E52A4EB904BCBAA4B1F75020C2846A7EB4"
pubkey []byte pubkey []byte
) )
const fee = 1e6 const fee = 1e6
...@@ -105,10 +104,10 @@ func DposPerf() { ...@@ -105,10 +104,10 @@ func DposPerf() {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
info := &dty.DposCBInfo{ info := &dty.DposCBInfo{
Cycle: task.Cycle, Cycle: task.Cycle,
StopHeight: 10, StopHeight: 10,
StopHash: "absadfafa", StopHash: "absadfafa",
Pubkey: strPubkey, Pubkey: strPubkey,
} }
if dposClient.csState.SendCBTx(info) { if dposClient.csState.SendCBTx(info) {
fmt.Println("sendCBTx ok") fmt.Println("sendCBTx ok")
...@@ -126,7 +125,7 @@ func DposPerf() { ...@@ -126,7 +125,7 @@ func DposPerf() {
for { for {
now = time.Now().Unix() now = time.Now().Unix()
task = DecideTaskByTime(now) task = DecideTaskByTime(now)
if now < task.CycleStart + (task.CycleStop-task.CycleStart)/2 { if now < task.CycleStart+(task.CycleStop-task.CycleStart)/2 {
break break
} }
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
...@@ -134,8 +133,8 @@ func DposPerf() { ...@@ -134,8 +133,8 @@ func DposPerf() {
vrfM := &dty.DposVrfMRegist{ vrfM := &dty.DposVrfMRegist{
Pubkey: strPubkey, Pubkey: strPubkey,
Cycle: task.Cycle, Cycle: task.Cycle,
M: "absadfafa", M: "absadfafa",
} }
if dposClient.csState.SendRegistVrfMTx(vrfM) { if dposClient.csState.SendRegistVrfMTx(vrfM) {
fmt.Println("SendRegistVrfMTx ok") fmt.Println("SendRegistVrfMTx ok")
...@@ -153,16 +152,16 @@ func DposPerf() { ...@@ -153,16 +152,16 @@ func DposPerf() {
for { for {
now = time.Now().Unix() now = time.Now().Unix()
task = DecideTaskByTime(now) task = DecideTaskByTime(now)
if now > task.CycleStart + (task.CycleStop-task.CycleStart)/2 { if now > task.CycleStart+(task.CycleStop-task.CycleStart)/2 {
break break
} }
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
} }
vrfRP := &dty.DposVrfRPRegist{ vrfRP := &dty.DposVrfRPRegist{
Pubkey: strPubkey, Pubkey: strPubkey,
Cycle: task.Cycle, Cycle: task.Cycle,
R: "Rabsadfafa", R: "Rabsadfafa",
P: "Pabsadfafa", P: "Pabsadfafa",
} }
if dposClient.csState.SendRegistVrfRPTx(vrfRP) { if dposClient.csState.SendRegistVrfRPTx(vrfRP) {
fmt.Println("SendRegistVrfRPTx ok") fmt.Println("SendRegistVrfRPTx ok")
...@@ -171,7 +170,7 @@ func DposPerf() { ...@@ -171,7 +170,7 @@ func DposPerf() {
} }
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
vrfInfo, err = dposClient.csState.QueryVrf(pubkey, task.Cycle) vrfInfo, err = dposClient.csState.QueryVrf(pubkey, task.Cycle)
if err != nil || vrfInfo == nil{ if err != nil || vrfInfo == nil {
fmt.Println("QueryVrf failed") fmt.Println("QueryVrf failed")
} else { } else {
fmt.Println("QueryVrf ok,", vrfInfo.Cycle, "|", len(vrfInfo.M), "|", len(vrfInfo.R), "|", len(vrfInfo.P)) fmt.Println("QueryVrf ok,", vrfInfo.Cycle, "|", len(vrfInfo.M), "|", len(vrfInfo.R), "|", len(vrfInfo.P))
......
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