Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
f27b8488
Commit
f27b8488
authored
Sep 11, 2019
by
张振华
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dpos-v2' of
https://github.com/zzh33cn/plugin
into dpos-v2
parents
cfafdcc5
4b0d5e13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
dpos_test.go
plugin/consensus/dpos/dpos_test.go
+13
-14
No files found.
plugin/consensus/dpos/dpos_test.go
View file @
f27b8488
...
@@ -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
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment