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
1c6d4f4b
Commit
1c6d4f4b
authored
Jul 19, 2019
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1d227a8a
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
914 additions
and
340 deletions
+914
-340
dpos.go
plugin/consensus/dpos/dpos.go
+20
-1
vote.go
plugin/dapp/dposvote/commands/vote.go
+51
-8
doc.go
plugin/dapp/dposvote/executor/doc.go
+1
-1
dposvotedb.go
plugin/dapp/dposvote/executor/dposvotedb.go
+296
-133
exec_del_local.go
plugin/dapp/dposvote/executor/exec_del_local.go
+35
-24
exec_local.go
plugin/dapp/dposvote/executor/exec_local.go
+37
-35
query.go
plugin/dapp/dposvote/executor/query.go
+11
-0
dposvote.proto
plugin/dapp/dposvote/proto/dposvote.proto
+56
-16
const.go
plugin/dapp/dposvote/types/const.go
+19
-2
dposvote.pb.go
plugin/dapp/dposvote/types/dposvote.pb.go
+381
-118
errors.go
plugin/dapp/dposvote/types/errors.go
+1
-0
table.go
plugin/dapp/dposvote/types/table.go
+6
-2
No files found.
plugin/consensus/dpos/dpos.go
View file @
1c6d4f4b
...
@@ -6,6 +6,7 @@ package dpos
...
@@ -6,6 +6,7 @@ package dpos
import
(
import
(
"bytes"
"bytes"
"encoding/hex"
"fmt"
"fmt"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/address"
"os"
"os"
...
@@ -455,7 +456,25 @@ func (client *Client)QueryCandidators()([]*dty.Candidator, error) {
...
@@ -455,7 +456,25 @@ func (client *Client)QueryCandidators()([]*dty.Candidator, error) {
return
nil
,
err
return
nil
,
err
}
}
res
=
*
result
.
(
*
dty
.
CandidatorReply
)
res
=
*
result
.
(
*
dty
.
CandidatorReply
)
return
res
.
GetCandidators
(),
nil
var
cands
[]
*
dty
.
Candidator
for
_
,
val
:=
range
res
.
GetCandidators
()
{
bPubkey
,
err
:=
hex
.
DecodeString
(
val
.
Pubkey
)
if
err
!=
nil
{
return
nil
,
err
}
cand
:=
&
dty
.
Candidator
{
Pubkey
:
bPubkey
,
Address
:
val
.
Address
,
Ip
:
val
.
Ip
,
Votes
:
val
.
Votes
,
Status
:
val
.
Status
,
}
cands
=
append
(
cands
,
cand
)
}
return
cands
,
nil
}
}
func
(
client
*
Client
)
MonitorCandidators
()
{
func
(
client
*
Client
)
MonitorCandidators
()
{
...
...
plugin/dapp/dposvote/commands/vote.go
View file @
1c6d4f4b
...
@@ -171,16 +171,16 @@ func addCancelVoteFlags(cmd *cobra.Command) {
...
@@ -171,16 +171,16 @@ func addCancelVoteFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
StringP
(
"pubkey"
,
"k"
,
""
,
"pubkey of a candidator"
)
cmd
.
Flags
()
.
StringP
(
"pubkey"
,
"k"
,
""
,
"pubkey of a candidator"
)
cmd
.
MarkFlagRequired
(
"pubkey"
)
cmd
.
MarkFlagRequired
(
"pubkey"
)
cmd
.
Flags
()
.
Int64P
(
"
votes"
,
"v"
,
0
,
"votes
"
)
cmd
.
Flags
()
.
Int64P
(
"
index"
,
"i"
,
0
,
"index
"
)
cmd
.
MarkFlagRequired
(
"
votes
"
)
cmd
.
MarkFlagRequired
(
"
index
"
)
}
}
func
cancelVote
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
cancelVote
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
pubkey
,
_
:=
cmd
.
Flags
()
.
GetString
(
"pubkey"
)
pubkey
,
_
:=
cmd
.
Flags
()
.
GetString
(
"pubkey"
)
votes
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"votes
"
)
index
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"index
"
)
payload
:=
fmt
.
Sprintf
(
"{
\"
pubkey
\"
:
\"
%s
\"
,
\"
votes
\"
:
\"
%d
\"
}"
,
pubkey
,
votes
)
payload
:=
fmt
.
Sprintf
(
"{
\"
pubkey
\"
:
\"
%s
\"
,
\"
index
\"
:
\"
%d
\"
}"
,
pubkey
,
index
)
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
dty
.
DPosX
),
Execer
:
types
.
ExecName
(
dty
.
DPosX
),
ActionName
:
dty
.
CreateCancelVoteTx
,
ActionName
:
dty
.
CreateCancelVoteTx
,
...
@@ -358,7 +358,7 @@ func vrfM(cmd *cobra.Command, args []string) {
...
@@ -358,7 +358,7 @@ func vrfM(cmd *cobra.Command, args []string) {
cycle
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"cycle"
)
cycle
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"cycle"
)
m
,
_
:=
cmd
.
Flags
()
.
GetString
(
"m"
)
m
,
_
:=
cmd
.
Flags
()
.
GetString
(
"m"
)
payload
:=
fmt
.
Sprintf
(
"{
\"
pubkey
\"
:
\"
%s
\"
,
\"
cycle
\"
:
\"
%d
\"
,
\"
m
\"
:
\"
%
X
\"
}"
,
pubkey
,
cycle
,
m
)
payload
:=
fmt
.
Sprintf
(
"{
\"
pubkey
\"
:
\"
%s
\"
,
\"
cycle
\"
:
\"
%d
\"
,
\"
m
\"
:
\"
%
s
\"
}"
,
pubkey
,
cycle
,
m
)
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
dty
.
DPosX
),
Execer
:
types
.
ExecName
(
dty
.
DPosX
),
ActionName
:
dty
.
CreateRegistVrfMTx
,
ActionName
:
dty
.
CreateRegistVrfMTx
,
...
@@ -399,10 +399,10 @@ func vrfRP(cmd *cobra.Command, args []string) {
...
@@ -399,10 +399,10 @@ func vrfRP(cmd *cobra.Command, args []string) {
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
pubkey
,
_
:=
cmd
.
Flags
()
.
GetString
(
"pubkey"
)
pubkey
,
_
:=
cmd
.
Flags
()
.
GetString
(
"pubkey"
)
cycle
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"cycle"
)
cycle
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"cycle"
)
r
,
_
:=
cmd
.
Flags
()
.
GetString
(
"r
"
)
hash
,
_
:=
cmd
.
Flags
()
.
GetString
(
"hash
"
)
p
,
_
:=
cmd
.
Flags
()
.
GetString
(
"p
"
)
p
roof
,
_
:=
cmd
.
Flags
()
.
GetString
(
"proof
"
)
payload
:=
fmt
.
Sprintf
(
"{
\"
pubkey
\"
:
\"
%s
\"
,
\"
cycle
\"
:
\"
%d
\"
,
\"
r
\"
:
\"
%s
\"
,
\"
p
\"
:
\"
%s
\"
}"
,
pubkey
,
cycle
,
r
,
p
)
payload
:=
fmt
.
Sprintf
(
"{
\"
pubkey
\"
:
\"
%s
\"
,
\"
cycle
\"
:
\"
%d
\"
,
\"
r
\"
:
\"
%s
\"
,
\"
p
\"
:
\"
%s
\"
}"
,
pubkey
,
cycle
,
hash
,
proof
)
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
dty
.
DPosX
),
Execer
:
types
.
ExecName
(
dty
.
DPosX
),
ActionName
:
dty
.
CreateRegistVrfRPTx
,
ActionName
:
dty
.
CreateRegistVrfRPTx
,
...
@@ -433,6 +433,7 @@ func addVrfQueryFlags(cmd *cobra.Command) {
...
@@ -433,6 +433,7 @@ func addVrfQueryFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Int64P
(
"timestamp"
,
"s"
,
0
,
"time stamp from 1970-1-1"
)
cmd
.
Flags
()
.
Int64P
(
"timestamp"
,
"s"
,
0
,
"time stamp from 1970-1-1"
)
cmd
.
Flags
()
.
Int64P
(
"cycle"
,
"c"
,
0
,
"cycle,one time point belongs to a cycle"
)
cmd
.
Flags
()
.
Int64P
(
"cycle"
,
"c"
,
0
,
"cycle,one time point belongs to a cycle"
)
cmd
.
Flags
()
.
StringP
(
"pubkeys"
,
"k"
,
""
,
"pubkeys"
)
}
}
func
vrfQuery
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
vrfQuery
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
@@ -441,6 +442,7 @@ func vrfQuery(cmd *cobra.Command, args []string) {
...
@@ -441,6 +442,7 @@ func vrfQuery(cmd *cobra.Command, args []string) {
dtime
,
_
:=
cmd
.
Flags
()
.
GetString
(
"time"
)
dtime
,
_
:=
cmd
.
Flags
()
.
GetString
(
"time"
)
timestamp
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"timestamp"
)
timestamp
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"timestamp"
)
cycle
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"cycle"
)
cycle
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"cycle"
)
pubkeys
,
_
:=
cmd
.
Flags
()
.
GetString
(
"pubkeys"
)
var
params
rpctypes
.
Query4Jrpc
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
dty
.
DPosX
params
.
Execer
=
dty
.
DPosX
...
@@ -497,5 +499,45 @@ func vrfQuery(cmd *cobra.Command, args []string) {
...
@@ -497,5 +499,45 @@ func vrfQuery(cmd *cobra.Command, args []string) {
var
res
dty
.
DposVrfReply
var
res
dty
.
DposVrfReply
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
ctx
.
Run
()
case
"topN"
:
if
cycle
<=
0
{
fmt
.
Println
(
"err cycle:"
,
cycle
)
return
}
req
:=
&
dty
.
DposVrfQuery
{
Ty
:
dty
.
QueryVrfByCycleForTopN
,
Cycle
:
cycle
,
}
params
.
FuncName
=
dty
.
FuncNameQueryVrfByCycleForTopN
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
dty
.
DposVrfReply
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
case
"pubkeys"
:
if
cycle
<=
0
{
fmt
.
Println
(
"err cycle:"
,
cycle
)
return
}
req
:=
&
dty
.
DposVrfQuery
{
Ty
:
dty
.
QueryVrfByCycleForPubkeys
,
Cycle
:
cycle
,
}
keys
:=
strings
.
Split
(
pubkeys
,
";"
)
for
_
,
key
:=
range
keys
{
req
.
Pubkeys
=
append
(
req
.
Pubkeys
,
key
)
}
params
.
FuncName
=
dty
.
FuncNameQueryVrfByCycleForPubkeys
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
dty
.
DposVrfReply
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
}
}
}
\ No newline at end of file
plugin/dapp/dposvote/executor/doc.go
View file @
1c6d4f4b
...
@@ -6,7 +6,7 @@ package executor
...
@@ -6,7 +6,7 @@ package executor
/*
/*
该合约主要是配合Dpos共识,完成(1)候选节点的注册、去注册、投票及查询管理。(2)Dpos共识运行过程中,得票数TopN(N为约定的受托节点数量)受托节点的VRF相关信息的分阶段发布管理。
该合约主要是配合Dpos共识,完成(1)候选节点的注册、去注册、投票及查询管理。(2)Dpos共识运行过程中,得票数TopN(N为约定的受托节点数量)受托节点的VRF相关信息的分阶段发布管理。
主要过程:
(1)系统初始运行时,会有默认的几个受托节点进行共识运行。
(1)系统初始运行时,会有默认的几个受托节点进行共识运行。
(2)系统运行后,可以重新选举受托节点,各个候选节点需要抵押10000个币(暂未实现),注册成为候选节点。
(2)系统运行后,可以重新选举受托节点,各个候选节点需要抵押10000个币(暂未实现),注册成为候选节点。
(3)候选节点可以在社区宣传,让大家为自己投票。
(3)候选节点可以在社区宣传,让大家为自己投票。
...
...
plugin/dapp/dposvote/executor/dposvotedb.go
View file @
1c6d4f4b
...
@@ -86,13 +86,136 @@ func queryVrfByTime(kvdb db.KVDB, req *dty.DposVrfQuery) (types.Message, error)
...
@@ -86,13 +86,136 @@ func queryVrfByTime(kvdb db.KVDB, req *dty.DposVrfQuery) (types.Message, error)
}
}
cycleInfo
:=
calcCycleByTime
(
req
.
Timestamp
)
cycleInfo
:=
calcCycleByTime
(
req
.
Timestamp
)
req
.
Ty
=
dty
.
QueryVrfBy
Tim
e
req
.
Ty
=
dty
.
QueryVrfBy
Cycl
e
req
.
Cycle
=
cycleInfo
.
cycle
req
.
Cycle
=
cycleInfo
.
cycle
return
queryVrfByCycle
(
kvdb
,
req
)
return
queryVrfByCycle
(
kvdb
,
req
)
}
}
//queryVrfByCycle 根据Cycle信息,查询TopN的受托节点的VRF信息
func
queryVrfByCycle
(
kvdb
db
.
KVDB
,
req
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
func
getJsonVrfs
(
vrfs
[]
*
dty
.
VrfInfo
)
[]
*
dty
.
JsonVrfInfo
{
if
req
.
Ty
!=
dty
.
QueryVrfByCycle
{
var
jsonVrfs
[]
*
dty
.
JsonVrfInfo
for
i
:=
0
;
i
<
len
(
vrfs
);
i
++
{
jsonVrf
:=
&
dty
.
JsonVrfInfo
{
Index
:
vrfs
[
i
]
.
Index
,
Pubkey
:
hex
.
EncodeToString
(
vrfs
[
i
]
.
Pubkey
),
Cycle
:
vrfs
[
i
]
.
Cycle
,
Height
:
vrfs
[
i
]
.
Height
,
M
:
string
(
vrfs
[
i
]
.
M
),
R
:
hex
.
EncodeToString
(
vrfs
[
i
]
.
R
),
P
:
hex
.
EncodeToString
(
vrfs
[
i
]
.
P
),
Time
:
vrfs
[
i
]
.
Time
,
}
jsonVrfs
=
append
(
jsonVrfs
,
jsonVrf
)
}
return
jsonVrfs
}
func
getVrfInfoFromVrfRP
(
vrfRP
*
dty
.
DposVrfRP
)
*
dty
.
VrfInfo
{
if
nil
==
vrfRP
{
return
nil
}
vrf
:=
&
dty
.
VrfInfo
{
Index
:
vrfRP
.
Index
,
Pubkey
:
vrfRP
.
Pubkey
,
Cycle
:
vrfRP
.
Cycle
,
Height
:
vrfRP
.
Height
,
M
:
vrfRP
.
M
,
R
:
vrfRP
.
R
,
P
:
vrfRP
.
P
,
Time
:
vrfRP
.
Time
,
}
return
vrf
}
func
isRecordExist
(
vrfM
*
dty
.
DposVrfM
,
vrfs
[]
*
dty
.
VrfInfo
)
bool
{
if
nil
==
vrfM
||
nil
==
vrfs
||
0
==
len
(
vrfs
)
{
return
false
}
for
i
:=
0
;
i
<
len
(
vrfs
);
i
++
{
if
vrfM
.
Cycle
==
vrfs
[
i
]
.
Cycle
&&
bytes
.
Equal
(
vrfM
.
Pubkey
,
vrfs
[
i
]
.
Pubkey
)
{
return
true
}
}
return
false
}
func
getVrfInfoFromVrfM
(
vrfM
*
dty
.
DposVrfM
)
*
dty
.
VrfInfo
{
if
nil
==
vrfM
{
return
nil
}
vrf
:=
&
dty
.
VrfInfo
{
Index
:
vrfM
.
Index
,
Pubkey
:
vrfM
.
Pubkey
,
Cycle
:
vrfM
.
Cycle
,
Height
:
vrfM
.
Height
,
M
:
vrfM
.
M
,
Time
:
vrfM
.
Time
,
}
return
vrf
}
//queryVrfByCycleAndPubkeys 根据Cycle、Pubkeys信息,查询受托节点的VRF信息
func
queryVrfByCycleAndPubkeys
(
kvdb
db
.
KVDB
,
pubkeys
[]
string
,
cycle
int64
)
[]
*
dty
.
VrfInfo
{
VrfRPTable
:=
dty
.
NewDposVrfRPTable
(
kvdb
)
query
:=
VrfRPTable
.
GetQuery
(
kvdb
)
var
tempPubkeys
[]
string
var
vrfs
[]
*
dty
.
VrfInfo
for
i
:=
0
;
i
<
len
(
pubkeys
);
i
++
{
rows
,
err
:=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%s:%018d"
,
pubkeys
[
i
],
cycle
)),
nil
,
1
,
0
)
if
err
!=
nil
{
logger
.
Error
(
"queryVrf RP failed"
,
"pubkey"
,
pubkeys
[
i
],
"cycle"
,
cycle
)
tempPubkeys
=
append
(
tempPubkeys
,
pubkeys
[
i
])
continue
}
vrfRP
:=
rows
[
0
]
.
Data
.
(
*
dty
.
DposVrfRP
)
vrf
:=
getVrfInfoFromVrfRP
(
vrfRP
)
vrfs
=
append
(
vrfs
,
vrf
)
}
if
tempPubkeys
==
nil
||
len
(
tempPubkeys
)
==
0
{
return
vrfs
}
vrfMTable
:=
dty
.
NewDposVrfMTable
(
kvdb
)
query
=
vrfMTable
.
GetQuery
(
kvdb
)
for
i
:=
0
;
i
<
len
(
tempPubkeys
);
i
++
{
rows
,
err
:=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%s:%018d"
,
tempPubkeys
[
i
],
cycle
)),
nil
,
1
,
0
)
if
err
!=
nil
{
logger
.
Error
(
"queryVrf M failed"
,
"pubkey"
,
tempPubkeys
[
i
],
"cycle"
,
cycle
)
continue
}
vrfM
:=
rows
[
0
]
.
Data
.
(
*
dty
.
DposVrfM
)
vrf
:=
getVrfInfoFromVrfM
(
vrfM
)
vrfs
=
append
(
vrfs
,
vrf
)
}
return
vrfs
}
//queryVrfByCycleForPubkeys 根据Cycle、Pubkeys信息,查询受托节点的VRF信息
func
queryVrfByCycleForPubkeys
(
kvdb
db
.
KVDB
,
req
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
if
req
.
Ty
!=
dty
.
QueryVrfByCycleForPubkeys
{
return
nil
,
types
.
ErrInvalidParam
}
vrfs
:=
queryVrfByCycleAndPubkeys
(
kvdb
,
req
.
Pubkeys
,
req
.
Cycle
)
return
&
dty
.
DposVrfReply
{
Vrf
:
getJsonVrfs
(
vrfs
)},
nil
}
//queryVrfByCycleForTopN 根据Cycle信息,查询TopN的受托节点的VRF信息
func
queryVrfByCycleForTopN
(
kvdb
db
.
KVDB
,
req
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
if
req
.
Ty
!=
dty
.
QueryVrfByCycleForTopN
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
@@ -107,64 +230,96 @@ func queryVrfByCycle(kvdb db.KVDB, req *dty.DposVrfQuery) (types.Message, error)
...
@@ -107,64 +230,96 @@ func queryVrfByCycle(kvdb db.KVDB, req *dty.DposVrfQuery) (types.Message, error)
return
nil
,
dty
.
ErrCandidatorNotEnough
return
nil
,
dty
.
ErrCandidatorNotEnough
}
}
var
pubkeys
[]
string
for
i
:=
0
;
i
<
len
(
res
.
Candidators
);
i
++
{
pubkeys
=
append
(
pubkeys
,
res
.
Candidators
[
i
]
.
Pubkey
)
//zzh
logger
.
Info
(
"queryVrfByCycleForTopN"
,
"pubkey"
,
pubkeys
[
i
])
}
vrfs
:=
queryVrfByCycleAndPubkeys
(
kvdb
,
pubkeys
,
req
.
Cycle
)
/*
VrfRPTable := dty.NewDposVrfRPTable(kvdb)
VrfRPTable := dty.NewDposVrfRPTable(kvdb)
query := VrfRPTable.GetQuery(kvdb)
query := VrfRPTable.GetQuery(kvdb)
var
tempCands
[]
*
dty
.
Candidator
var tempCands [] *dty.
Json
Candidator
var vrfs [] *dty.VrfInfo
var vrfs [] *dty.VrfInfo
for i := 0; i < len(res.Candidators); i ++ {
for i := 0; i < len(res.Candidators); i ++ {
rows
,
err
:=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%
X
:%018d"
,
res
.
Candidators
[
i
]
.
Pubkey
,
req
.
Cycle
)),
nil
,
1
,
0
)
rows, err := query.ListIndex("pubkey_cycle", []byte(fmt.Sprintf("%
s
:%018d", res.Candidators[i].Pubkey, req.Cycle)), nil, 1, 0)
if err != nil {
if err != nil {
logger
.
Error
(
"queryVrf RP failed"
,
"pubkey"
,
fmt
.
Sprintf
(
"%X"
,
res
.
Candidators
[
i
]
.
Pubkey
)
,
"cycle"
,
req
.
Cycle
)
logger.Error("queryVrf RP failed", "pubkey",
res.Candidators[i].Pubkey
, "cycle", req.Cycle)
tempCands = append(tempCands, res.Candidators[i])
tempCands = append(tempCands, res.Candidators[i])
continue
continue
}
}
vrfRP := rows[0].Data.(*dty.DposVrfRP)
vrfRP := rows[0].Data.(*dty.DposVrfRP)
vrf
:=
&
dty
.
VrfInfo
{
vrf := getVrfInfoFromVrfRP(vrfRP)
Index
:
vrfRP
.
Index
,
Pubkey
:
vrfRP
.
Pubkey
,
Cycle
:
vrfRP
.
Cycle
,
Height
:
vrfRP
.
Height
,
M
:
vrfRP
.
M
,
R
:
vrfRP
.
R
,
P
:
vrfRP
.
P
,
Time
:
vrfRP
.
Time
,
}
vrfs = append(vrfs, vrf)
vrfs = append(vrfs, vrf)
}
}
if tempCands == nil || len(tempCands) == 0 {
if tempCands == nil || len(tempCands) == 0 {
return
&
dty
.
DposVrfReply
{
Vrf
:
vrfs
},
nil
return &dty.DposVrfReply{Vrf:
getJsonVrfs(vrfs)
}, nil
}
}
vrfMTable := dty.NewDposVrfMTable(kvdb)
vrfMTable := dty.NewDposVrfMTable(kvdb)
query = vrfMTable.GetQuery(kvdb)
query = vrfMTable.GetQuery(kvdb)
for i := 0; i < len(tempCands); i++ {
for i := 0; i < len(tempCands); i++ {
rows
,
err
:=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%
X
:%018d"
,
tempCands
[
i
]
.
Pubkey
,
req
.
Cycle
)),
nil
,
1
,
0
)
rows, err := query.ListIndex("pubkey_cycle", []byte(fmt.Sprintf("%
s
:%018d", tempCands[i].Pubkey, req.Cycle)), nil, 1, 0)
if err != nil {
if err != nil {
logger
.
Error
(
"queryVrf M failed"
,
"pubkey"
,
fmt
.
Sprintf
(
"%X"
,
res
.
Candidators
[
i
]
.
Pubkey
)
,
"cycle"
,
req
.
Cycle
)
logger.Error("queryVrf M failed", "pubkey",
res.Candidators[i].Pubkey
, "cycle", req.Cycle)
continue
continue
}
}
vrfM := rows[0].Data.(*dty.DposVrfM)
vrfM := rows[0].Data.(*dty.DposVrfM)
vrf
:=
&
dty
.
VrfInfo
{
vrf := getVrfInfoFromVrfM(vrfM)
Index
:
vrfM
.
Index
,
Pubkey
:
vrfM
.
Pubkey
,
Cycle
:
vrfM
.
Cycle
,
Height
:
vrfM
.
Height
,
M
:
vrfM
.
M
,
Time
:
vrfM
.
Time
,
}
vrfs = append(vrfs, vrf)
vrfs = append(vrfs, vrf)
}
}
*/
return
&
dty
.
DposVrfReply
{
Vrf
:
vrfs
},
nil
return
&
dty
.
DposVrfReply
{
Vrf
:
getJsonVrfs
(
vrfs
)
},
nil
}
}
//queryVrfByCycle 根据Cycle信息,查询所有受托节点的VRF信息
func
queryVrfByCycle
(
kvdb
db
.
KVDB
,
req
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
if
req
.
Ty
!=
dty
.
QueryVrfByCycle
{
return
nil
,
types
.
ErrInvalidParam
}
VrfRPTable
:=
dty
.
NewDposVrfRPTable
(
kvdb
)
query
:=
VrfRPTable
.
GetQuery
(
kvdb
)
var
vrfs
[]
*
dty
.
VrfInfo
rows
,
err
:=
query
.
ListIndex
(
"cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
req
.
Cycle
)),
nil
,
0
,
0
)
if
err
!=
nil
{
logger
.
Error
(
"queryVrf RP failed"
,
"cycle"
,
req
.
Cycle
)
}
else
{
for
i
:=
0
;
i
<
len
(
rows
);
i
++
{
vrfRP
:=
rows
[
i
]
.
Data
.
(
*
dty
.
DposVrfRP
)
vrf
:=
getVrfInfoFromVrfRP
(
vrfRP
)
vrfs
=
append
(
vrfs
,
vrf
)
}
}
vrfMTable
:=
dty
.
NewDposVrfMTable
(
kvdb
)
query
=
vrfMTable
.
GetQuery
(
kvdb
)
rows
,
err
=
query
.
ListIndex
(
"cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
req
.
Cycle
)),
nil
,
1
,
0
)
if
err
!=
nil
{
logger
.
Error
(
"queryVrf M failed"
,
"cycle"
,
req
.
Cycle
)
}
else
{
for
i
:=
0
;
i
<
len
(
rows
);
i
++
{
vrfM
:=
rows
[
i
]
.
Data
.
(
*
dty
.
DposVrfM
)
if
!
isRecordExist
(
vrfM
,
vrfs
)
{
vrf
:=
getVrfInfoFromVrfM
(
vrfM
)
vrfs
=
append
(
vrfs
,
vrf
)
}
}
}
return
&
dty
.
DposVrfReply
{
Vrf
:
getJsonVrfs
(
vrfs
)},
nil
}
//queryCands 根据候选节点的Pubkey下旬候选节点信息,得票数、状态等
//queryCands 根据候选节点的Pubkey下旬候选节点信息,得票数、状态等
func
queryCands
(
kvdb
db
.
KVDB
,
req
*
dty
.
CandidatorQuery
)
(
types
.
Message
,
error
)
{
func
queryCands
(
kvdb
db
.
KVDB
,
req
*
dty
.
CandidatorQuery
)
(
types
.
Message
,
error
)
{
var
cands
[]
*
dty
.
Candidator
var
cands
[]
*
dty
.
Json
Candidator
candTable
:=
dty
.
NewDposCandidatorTable
(
kvdb
)
candTable
:=
dty
.
NewDposCandidatorTable
(
kvdb
)
query
:=
candTable
.
GetQuery
(
kvdb
)
query
:=
candTable
.
GetQuery
(
kvdb
)
...
@@ -176,8 +331,8 @@ func queryCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, error) {
...
@@ -176,8 +331,8 @@ func queryCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, error) {
}
}
candInfo
:=
rows
[
0
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
candInfo
:=
rows
[
0
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
cand
:=
&
dty
.
Candidator
{
cand
:=
&
dty
.
Json
Candidator
{
Pubkey
:
candInfo
.
Pubkey
,
Pubkey
:
strings
.
ToUpper
(
hex
.
EncodeToString
(
candInfo
.
Pubkey
))
,
Address
:
candInfo
.
Address
,
Address
:
candInfo
.
Address
,
Ip
:
candInfo
.
Ip
,
Ip
:
candInfo
.
Ip
,
Votes
:
candInfo
.
Votes
,
Votes
:
candInfo
.
Votes
,
...
@@ -190,7 +345,7 @@ func queryCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, error) {
...
@@ -190,7 +345,7 @@ func queryCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, error) {
//queryTopNCands 查询得票数TopN的候选节点信息,包括得票数,状态等
//queryTopNCands 查询得票数TopN的候选节点信息,包括得票数,状态等
func
queryTopNCands
(
kvdb
db
.
KVDB
,
req
*
dty
.
CandidatorQuery
)
(
types
.
Message
,
error
)
{
func
queryTopNCands
(
kvdb
db
.
KVDB
,
req
*
dty
.
CandidatorQuery
)
(
types
.
Message
,
error
)
{
var
cands
[]
*
dty
.
Candidator
var
cands
[]
*
dty
.
Json
Candidator
candTable
:=
dty
.
NewDposCandidatorTable
(
kvdb
)
candTable
:=
dty
.
NewDposCandidatorTable
(
kvdb
)
query
:=
candTable
.
GetQuery
(
kvdb
)
query
:=
candTable
.
GetQuery
(
kvdb
)
...
@@ -199,8 +354,8 @@ func queryTopNCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, erro
...
@@ -199,8 +354,8 @@ func queryTopNCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, erro
if
err
==
nil
{
if
err
==
nil
{
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
candInfo
:=
rows
[
index
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
candInfo
:=
rows
[
index
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
cand
:=
&
dty
.
Candidator
{
cand
:=
&
dty
.
Json
Candidator
{
Pubkey
:
candInfo
.
Pubkey
,
Pubkey
:
strings
.
ToUpper
(
hex
.
EncodeToString
(
candInfo
.
Pubkey
))
,
Address
:
candInfo
.
Address
,
Address
:
candInfo
.
Address
,
Ip
:
candInfo
.
Ip
,
Ip
:
candInfo
.
Ip
,
Votes
:
candInfo
.
Votes
,
Votes
:
candInfo
.
Votes
,
...
@@ -220,8 +375,8 @@ func queryTopNCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, erro
...
@@ -220,8 +375,8 @@ func queryTopNCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, erro
if
err
==
nil
{
if
err
==
nil
{
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
candInfo
:=
rows
[
index
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
candInfo
:=
rows
[
index
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
cand
:=
&
dty
.
Candidator
{
cand
:=
&
dty
.
Json
Candidator
{
Pubkey
:
candInfo
.
Pubkey
,
Pubkey
:
strings
.
ToUpper
(
hex
.
EncodeToString
(
candInfo
.
Pubkey
))
,
Address
:
candInfo
.
Address
,
Address
:
candInfo
.
Address
,
Ip
:
candInfo
.
Ip
,
Ip
:
candInfo
.
Ip
,
Votes
:
candInfo
.
Votes
,
Votes
:
candInfo
.
Votes
,
...
@@ -239,8 +394,8 @@ func queryTopNCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, erro
...
@@ -239,8 +394,8 @@ func queryTopNCands(kvdb db.KVDB, req *dty.CandidatorQuery) (types.Message, erro
if
err
==
nil
{
if
err
==
nil
{
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
candInfo
:=
rows
[
index
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
candInfo
:=
rows
[
index
]
.
Data
.
(
*
dty
.
CandidatorInfo
)
cand
:=
&
dty
.
Candidator
{
cand
:=
&
dty
.
Json
Candidator
{
Pubkey
:
candInfo
.
Pubkey
,
Pubkey
:
strings
.
ToUpper
(
hex
.
EncodeToString
(
candInfo
.
Pubkey
))
,
Address
:
candInfo
.
Address
,
Address
:
candInfo
.
Address
,
Ip
:
candInfo
.
Ip
,
Ip
:
candInfo
.
Ip
,
Votes
:
candInfo
.
Votes
,
Votes
:
candInfo
.
Votes
,
...
@@ -278,7 +433,7 @@ func isValidPubkey(pubkeys []string, pubkey string) bool{
...
@@ -278,7 +433,7 @@ func isValidPubkey(pubkeys []string, pubkey string) bool{
//queryVote 根据用户地址信息查询用户的投票情况
//queryVote 根据用户地址信息查询用户的投票情况
func
queryVote
(
kvdb
db
.
KVDB
,
req
*
dty
.
DposVoteQuery
)
(
types
.
Message
,
error
)
{
func
queryVote
(
kvdb
db
.
KVDB
,
req
*
dty
.
DposVoteQuery
)
(
types
.
Message
,
error
)
{
var
voters
[]
*
dty
.
DposVoter
var
voters
[]
*
dty
.
Json
DposVoter
voteTable
:=
dty
.
NewDposVoteTable
(
kvdb
)
voteTable
:=
dty
.
NewDposVoteTable
(
kvdb
)
query
:=
voteTable
.
GetQuery
(
kvdb
)
query
:=
voteTable
.
GetQuery
(
kvdb
)
...
@@ -289,7 +444,14 @@ func queryVote(kvdb db.KVDB, req *dty.DposVoteQuery) (types.Message, error) {
...
@@ -289,7 +444,14 @@ func queryVote(kvdb db.KVDB, req *dty.DposVoteQuery) (types.Message, error) {
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
for
index
:=
0
;
index
<
len
(
rows
);
index
++
{
voter
:=
rows
[
index
]
.
Data
.
(
*
dty
.
DposVoter
)
voter
:=
rows
[
index
]
.
Data
.
(
*
dty
.
DposVoter
)
voters
=
append
(
voters
,
voter
)
jsonVoter
:=
&
dty
.
JsonDposVoter
{
FromAddr
:
voter
.
FromAddr
,
Pubkey
:
strings
.
ToUpper
(
hex
.
EncodeToString
(
voter
.
Pubkey
)),
Votes
:
voter
.
Votes
,
Index
:
voter
.
Index
,
Time
:
voter
.
Time
,
}
voters
=
append
(
voters
,
jsonVoter
)
}
}
//如果不指定pubkeys,则返回所有;否则,需要判断pubkey是否为指定的值之一。
//如果不指定pubkeys,则返回所有;否则,需要判断pubkey是否为指定的值之一。
...
@@ -299,7 +461,7 @@ func queryVote(kvdb db.KVDB, req *dty.DposVoteQuery) (types.Message, error) {
...
@@ -299,7 +461,7 @@ func queryVote(kvdb db.KVDB, req *dty.DposVoteQuery) (types.Message, error) {
reply
:=
&
dty
.
DposVoteReply
{}
reply
:=
&
dty
.
DposVoteReply
{}
for
index
:=
0
;
index
<
len
(
voters
);
index
++
{
for
index
:=
0
;
index
<
len
(
voters
);
index
++
{
strPubkey
:=
hex
.
EncodeToString
(
voters
[
index
]
.
Pubkey
)
strPubkey
:=
voters
[
index
]
.
Pubkey
if
isValidPubkey
(
req
.
Pubkeys
,
strPubkey
)
{
if
isValidPubkey
(
req
.
Pubkeys
,
strPubkey
)
{
reply
.
Votes
=
append
(
reply
.
Votes
,
voters
[
index
])
reply
.
Votes
=
append
(
reply
.
Votes
,
voters
[
index
])
}
}
...
@@ -324,7 +486,7 @@ func (action *Action) getIndex() int64 {
...
@@ -324,7 +486,7 @@ func (action *Action) getIndex() int64 {
}
}
//getReceiptLog 根据候选节点信息及投票信息生成收据信息
//getReceiptLog 根据候选节点信息及投票信息生成收据信息
func
(
action
*
Action
)
getReceiptLog
(
candInfo
*
dty
.
CandidatorInfo
,
statusChange
bool
,
vote
d
bool
,
vote
*
dty
.
DposVote
)
*
types
.
ReceiptLog
{
func
(
action
*
Action
)
getReceiptLog
(
candInfo
*
dty
.
CandidatorInfo
,
statusChange
bool
,
vote
Type
int32
,
vote
*
dty
.
DposVoter
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
:=
&
types
.
ReceiptLog
{}
r
:=
&
dty
.
ReceiptCandicator
{}
r
:=
&
dty
.
ReceiptCandicator
{}
//r.StartIndex = can.StartIndex
//r.StartIndex = can.StartIndex
...
@@ -347,14 +509,17 @@ func (action *Action) getReceiptLog(candInfo *dty.CandidatorInfo, statusChange b
...
@@ -347,14 +509,17 @@ func (action *Action) getReceiptLog(candInfo *dty.CandidatorInfo, statusChange b
r
.
PreStatus
=
candInfo
.
PreStatus
r
.
PreStatus
=
candInfo
.
PreStatus
r
.
Address
=
candInfo
.
Address
r
.
Address
=
candInfo
.
Address
r
.
Pubkey
=
candInfo
.
Pubkey
r
.
Pubkey
=
candInfo
.
Pubkey
r
.
Voted
=
voted
r
.
VoteType
=
voteType
if
voted
{
switch
(
voteType
)
{
r
.
Votes
=
vote
.
Votes
case
dty
.
VoteTypeNone
:
r
.
FromAddr
=
vote
.
FromAddr
case
dty
.
VoteTypeVote
:
if
r
.
Votes
<
0
{
r
.
Vote
=
vote
case
dty
.
VoteTypeCancelVote
:
log
.
Ty
=
dty
.
TyLogCandicatorCancelVoted
log
.
Ty
=
dty
.
TyLogCandicatorCancelVoted
}
r
.
Vote
=
vote
case
dty
.
VoteTypeCancelAllVote
:
}
}
r
.
CandInfo
=
candInfo
r
.
CandInfo
=
candInfo
log
.
Log
=
types
.
Encode
(
r
)
log
.
Log
=
types
.
Encode
(
r
)
return
log
return
log
...
@@ -435,7 +600,7 @@ func (action *Action) Regist(regist *dty.DposCandidatorRegist) (*types.Receipt,
...
@@ -435,7 +600,7 @@ func (action *Action) Regist(regist *dty.DposCandidatorRegist) (*types.Receipt,
candInfo
.
StartTxHash
=
common
.
ToHex
(
action
.
txhash
)
candInfo
.
StartTxHash
=
common
.
ToHex
(
action
.
txhash
)
candInfo
.
PreIndex
=
0
candInfo
.
PreIndex
=
0
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
false
,
fals
e
,
nil
)
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
false
,
dty
.
VoteTypeNon
e
,
nil
)
logs
=
append
(
logs
,
receiptLog
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
...
@@ -494,8 +659,11 @@ func (action *Action) ReRegist(regist *dty.DposCandidatorRegist) (*types.Receipt
...
@@ -494,8 +659,11 @@ func (action *Action) ReRegist(regist *dty.DposCandidatorRegist) (*types.Receipt
candInfo
.
Index
=
candInfo
.
StartIndex
candInfo
.
Index
=
candInfo
.
StartIndex
candInfo
.
StartTxHash
=
common
.
ToHex
(
action
.
txhash
)
candInfo
.
StartTxHash
=
common
.
ToHex
(
action
.
txhash
)
candInfo
.
PreIndex
=
0
candInfo
.
PreIndex
=
0
candInfo
.
Votes
=
0
candInfo
.
Voters
=
nil
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
false
,
dty
.
VoteTypeNone
,
nil
)
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
false
,
false
,
nil
)
logs
=
append
(
logs
,
receiptLog
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
...
@@ -563,8 +731,12 @@ func (action *Action) CancelRegist(req *dty.DposCandidatorCancelRegist) (*types.
...
@@ -563,8 +731,12 @@ func (action *Action) CancelRegist(req *dty.DposCandidatorCancelRegist) (*types.
candInfo
.
Status
=
dty
.
CandidatorStatusCancelRegist
candInfo
.
Status
=
dty
.
CandidatorStatusCancelRegist
candInfo
.
PreIndex
=
candInfo
.
Index
candInfo
.
PreIndex
=
candInfo
.
Index
candInfo
.
Index
=
action
.
getIndex
()
candInfo
.
Index
=
action
.
getIndex
()
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
true
,
dty
.
VoteTypeCancelAllVote
,
nil
)
candInfo
.
Votes
=
0
candInfo
.
Voters
=
nil
candInfo
.
Voters
=
nil
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
true
,
false
,
nil
)
logs
=
append
(
logs
,
receiptLog
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
...
@@ -596,8 +768,7 @@ func (action *Action) Vote(vote *dty.DposVote) (*types.Receipt, error) {
...
@@ -596,8 +768,7 @@ func (action *Action) Vote(vote *dty.DposVote) (*types.Receipt, error) {
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
logger
.
Info
(
"vote"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"candicator"
,
logger
.
Info
(
"vote"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"candicator"
,
candInfo
.
String
())
candInfo
.
String
())
statusChange
:=
false
statusChange
:=
false
if
candInfo
.
Status
==
dty
.
CandidatorStatusRegist
||
candInfo
.
Status
==
dty
.
CandidatorStatusReRegist
{
if
candInfo
.
Status
==
dty
.
CandidatorStatusRegist
||
candInfo
.
Status
==
dty
.
CandidatorStatusReRegist
{
...
@@ -632,7 +803,7 @@ func (action *Action) Vote(vote *dty.DposVote) (*types.Receipt, error) {
...
@@ -632,7 +803,7 @@ func (action *Action) Vote(vote *dty.DposVote) (*types.Receipt, error) {
candInfo
.
PreIndex
=
candInfo
.
Index
candInfo
.
PreIndex
=
candInfo
.
Index
candInfo
.
Index
=
action
.
getIndex
()
candInfo
.
Index
=
action
.
getIndex
()
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
statusChange
,
true
,
vote
)
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
statusChange
,
dty
.
VoteTypeVote
,
voter
)
logs
=
append
(
logs
,
receiptLog
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
...
@@ -663,67 +834,37 @@ func (action *Action) CancelVote(vote *dty.DposCancelVote) (*types.Receipt, erro
...
@@ -663,67 +834,37 @@ func (action *Action) CancelVote(vote *dty.DposCancelVote) (*types.Receipt, erro
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
logger
.
Info
(
"CancelVote"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"candicator"
,
logger
.
Info
(
"CancelVote"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"pubkey"
,
vote
.
Pubkey
,
"index"
,
vote
.
Index
)
candInfo
.
String
())
votes
:=
vote
.
Votes
findVote
:=
false
availVotes
:=
int64
(
0
)
var
oriVote
*
dty
.
DposVoter
enoughVotes
:=
false
for
index
,
voter
:=
range
candInfo
.
Voters
{
for
_
,
voter
:=
range
candInfo
.
Voters
{
if
voter
.
FromAddr
==
action
.
fromaddr
&&
bytes
.
Equal
(
voter
.
Pubkey
,
bPubkey
)
&&
voter
.
Index
==
vote
.
Index
{
if
voter
.
FromAddr
==
action
.
fromaddr
&&
bytes
.
Equal
(
voter
.
Pubkey
,
bPubkey
){
oriVote
=
voter
//if action.blocktime - voter.Time >= dty.VoteFrozenTime {
findVote
=
true
availVotes
+=
voter
.
Votes
candInfo
.
Voters
=
append
(
candInfo
.
Voters
[
0
:
index
],
candInfo
.
Voters
[
index
+
1
:
]
...
)
if
availVotes
>=
votes
{
break
enoughVotes
=
true
break
}
//}
}
}
}
}
if
!
enoughVotes
{
logger
.
Error
(
"RevokeVote failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"not enough avail votes"
,
availVotes
,
"revoke votes"
,
vote
.
Votes
)
return
nil
,
dty
.
ErrNotEnoughVotes
}
for
index
,
voter
:=
range
candInfo
.
Voters
{
if
!
findVote
{
if
voter
.
FromAddr
==
action
.
fromaddr
&&
bytes
.
Equal
(
voter
.
Pubkey
,
bPubkey
){
logger
.
Error
(
"CancelVote failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
vote
.
Pubkey
,
"index"
,
vote
.
Index
)
//if action.blocktime - voter.Time >= dty.VoteFrozenTime {
return
nil
,
dty
.
ErrNoSuchVote
if
voter
.
Votes
>
votes
{
voter
.
Votes
-=
votes
break
}
else
if
voter
.
Votes
==
votes
{
candInfo
.
Voters
=
append
(
candInfo
.
Voters
[
:
index
],
candInfo
.
Voters
[
index
+
1
:
]
...
)
break
}
else
{
candInfo
.
Voters
=
append
(
candInfo
.
Voters
[
:
index
],
candInfo
.
Voters
[
index
+
1
:
]
...
)
votes
=
votes
-
voter
.
Votes
}
//}
}
}
}
checkValue
:=
vote
.
Votes
receipt
,
err
:=
action
.
coinsAccount
.
ExecActive
(
action
.
fromaddr
,
action
.
execaddr
,
oriVote
.
Votes
)
receipt
,
err
:=
action
.
coinsAccount
.
ExecActive
(
action
.
fromaddr
,
action
.
execaddr
,
checkValue
)
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Error
(
"ExecActive failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
checkValue
,
"err"
,
err
.
Error
())
logger
.
Error
(
"ExecActive failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
oriVote
.
Votes
,
"err"
,
err
.
Error
())
return
nil
,
err
return
nil
,
err
}
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
candInfo
.
Votes
-=
vote
.
Votes
candInfo
.
Votes
-=
oriVote
.
Votes
vote2
:=
&
dty
.
DposVote
{
FromAddr
:
action
.
fromaddr
,
Pubkey
:
vote
.
Pubkey
,
Votes
:
(
-
1
)
*
vote
.
Votes
,
}
candInfo
.
PreIndex
=
candInfo
.
Index
candInfo
.
PreIndex
=
candInfo
.
Index
candInfo
.
Index
=
action
.
getIndex
()
candInfo
.
Index
=
action
.
getIndex
()
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
false
,
true
,
vote2
)
receiptLog
:=
action
.
getReceiptLog
(
candInfo
,
false
,
dty
.
VoteTypeCancelVote
,
oriVote
)
logs
=
append
(
logs
,
receiptLog
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
kv
=
append
(
kv
,
action
.
saveCandicator
(
candInfo
)
...
)
...
@@ -743,47 +884,54 @@ func (action *Action) RegistVrfM(vrfMReg *dty.DposVrfMRegist) (*types.Receipt, e
...
@@ -743,47 +884,54 @@ func (action *Action) RegistVrfM(vrfMReg *dty.DposVrfMRegist) (*types.Receipt, e
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
/*
bM, err := hex.DecodeString(vrfMReg.M)
bM, err := hex.DecodeString(vrfMReg.M)
if err != nil {
if err != nil {
logger.Info("RegistVrfM", "addr", action.fromaddr, "execaddr", action.execaddr, "M is not correct",
logger.Info("RegistVrfM", "addr", action.fromaddr, "execaddr", action.execaddr, "M is not correct",
vrfMReg.M)
vrfMReg.M)
return nil, types.ErrInvalidParam
return nil, types.ErrInvalidParam
}
}*/
bM
:=
[]
byte
(
vrfMReg
.
M
)
req
:=
&
dty
.
CandidatorQuery
{}
req
.
Pubkeys
=
append
(
req
.
Pubkeys
,
vrfMReg
.
Pubkey
)
req
:=
&
dty
.
CandidatorQuery
{
TopN
:
int32
(
dposDelegateNum
),
}
reply
,
err
:=
query
TopN
Cands
(
action
.
localDB
,
req
)
reply
,
err
:=
queryCands
(
action
.
localDB
,
req
)
res
:=
reply
.
(
*
dty
.
CandidatorReply
)
res
:=
reply
.
(
*
dty
.
CandidatorReply
)
if
err
!=
nil
||
len
(
res
.
Candidators
)
<
int
(
dposDelegateNum
){
if
err
!=
nil
||
len
(
res
.
Candidators
)
!=
1
||
res
.
Candidators
[
0
]
.
Status
==
dty
.
CandidatorStatusCancelRegist
{
logger
.
Error
(
"RegistVrfM failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"not enough Candidators"
,
logger
.
Error
(
"RegistVrfM failed for no valid Candidators"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
)
dposDelegateNum
)
return
nil
,
dty
.
ErrCandidatorNotExist
return
nil
,
dty
.
ErrCandidatorNotEnough
}
}
legalCand
:=
false
legalCand
:=
false
for
i
:=
0
;
i
<
len
(
res
.
Candidators
);
i
++
{
if
(
strings
.
ToUpper
(
vrfMReg
.
Pubkey
)
==
res
.
Candidators
[
0
]
.
Pubkey
)
&&
(
action
.
fromaddr
==
res
.
Candidators
[
0
]
.
Address
)
{
if
bytes
.
Equal
(
bPubkey
,
res
.
Candidators
[
i
]
.
Pubkey
)
&&
action
.
fromaddr
==
res
.
Candidators
[
i
]
.
Address
{
legalCand
=
true
legalCand
=
true
}
}
}
if
!
legalCand
{
if
!
legalCand
{
logger
.
Error
(
"RegistVrfM failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"not legal Candidator
s
"
,
logger
.
Error
(
"RegistVrfM failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"not legal Candidator"
,
res
.
String
())
res
.
Candidators
[
0
]
.
String
())
return
nil
,
dty
.
ErrCandidatorNotLegal
return
nil
,
dty
.
ErrCandidatorNotLegal
}
}
cycleInfo
:=
calcCycleByTime
(
action
.
blocktime
)
cycleInfo
:=
calcCycleByTime
(
action
.
blocktime
)
middleTime
:=
cycleInfo
.
cycleStart
+
(
cycleInfo
.
cycleStop
-
cycleInfo
.
cycleStart
)
/
2
if
vrfMReg
.
Cycle
!=
cycleInfo
.
cycle
{
if
vrfMReg
.
Cycle
!=
cycleInfo
.
cycle
{
logger
.
Error
(
"RegistVrfM failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"cycle is not the same with current blocktime"
,
logger
.
Error
(
"RegistVrfM failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"cycle is not correct"
,
vrfMReg
.
String
())
vrfMReg
.
String
(),
"current cycle info"
,
fmt
.
Sprintf
(
"cycle:%d,start:%d,stop:%d,time:%d"
,
cycleInfo
.
cycle
,
cycleInfo
.
cycleStart
,
cycleInfo
.
cycleStop
,
action
.
blocktime
))
return
nil
,
types
.
ErrInvalidParam
}
else
if
action
.
blocktime
>
middleTime
{
logger
.
Error
(
"RegistVrfM failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"time is not allowed, over the middle of this cycle"
,
action
.
blocktime
,
"allow time"
,
fmt
.
Sprintf
(
"cycle:%d,start:%d,middle:%d,stop:%d"
,
cycleInfo
.
cycle
,
cycleInfo
.
cycleStart
,
middleTime
,
cycleInfo
.
cycleStop
))
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
//todo 还需要检查是否针对这个cycle已经有注册过M了,如果注册过了,也需要提示失败
logger
.
Info
(
"RegistVrfM"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"pubkey"
,
vrfMReg
.
Pubkey
,
"cycle"
,
vrfMReg
.
Cycle
,
"M"
,
vrfMReg
.
M
,
"now"
,
action
.
blocktime
,
"info"
,
fmt
.
Sprintf
(
"cycle:%d,start:%d,middle:%d,stop:%d"
,
cycleInfo
.
cycle
,
cycleInfo
.
cycleStart
,
middleTime
,
cycleInfo
.
cycleStop
))
//todo 还需要检查是否针对这个cycle已经有注册过M了,如果注册过了,也需要提示失败
vrfMTable
:=
dty
.
NewDposVrfMTable
(
action
.
localDB
)
vrfMTable
:=
dty
.
NewDposVrfMTable
(
action
.
localDB
)
query
:=
vrfMTable
.
GetQuery
(
action
.
localDB
)
query
:=
vrfMTable
.
GetQuery
(
action
.
localDB
)
_
,
err
=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
bPubkey
,
vrfMReg
.
Cycle
)),
nil
,
1
,
0
)
_
,
err
=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
bPubkey
,
vrfMReg
.
Cycle
)),
nil
,
1
,
0
)
...
@@ -802,6 +950,9 @@ func (action *Action) RegistVrfM(vrfMReg *dty.DposVrfMRegist) (*types.Receipt, e
...
@@ -802,6 +950,9 @@ func (action *Action) RegistVrfM(vrfMReg *dty.DposVrfMRegist) (*types.Receipt, e
r
.
Height
=
action
.
mainHeight
r
.
Height
=
action
.
mainHeight
r
.
M
=
bM
r
.
M
=
bM
r
.
Time
=
action
.
blocktime
r
.
Time
=
action
.
blocktime
r
.
CycleStart
=
cycleInfo
.
cycleStart
r
.
CycleStop
=
cycleInfo
.
cycleStop
r
.
CycleMiddle
=
middleTime
log
.
Ty
=
dty
.
TyLogVrfMRegist
log
.
Ty
=
dty
.
TyLogVrfMRegist
log
.
Log
=
types
.
Encode
(
r
)
log
.
Log
=
types
.
Encode
(
r
)
...
@@ -818,43 +969,52 @@ func (action *Action) RegistVrfRP(vrfRPReg *dty.DposVrfRPRegist) (*types.Receipt
...
@@ -818,43 +969,52 @@ func (action *Action) RegistVrfRP(vrfRPReg *dty.DposVrfRPRegist) (*types.Receipt
bPubkey
,
err
:=
hex
.
DecodeString
(
vrfRPReg
.
Pubkey
)
bPubkey
,
err
:=
hex
.
DecodeString
(
vrfRPReg
.
Pubkey
)
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Info
(
"RegistVrf
M
"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"pubkey is not correct"
,
logger
.
Info
(
"RegistVrf
RP
"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"pubkey is not correct"
,
vrfRPReg
.
Pubkey
)
vrfRPReg
.
Pubkey
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
bR
,
err
:=
hex
.
DecodeString
(
vrfRPReg
.
R
)
bR
,
err
:=
hex
.
DecodeString
(
vrfRPReg
.
R
)
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Info
(
"RegistVrf
M"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"M
is not correct"
,
logger
.
Info
(
"RegistVrf
RP"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"R
is not correct"
,
vrfRPReg
.
R
)
vrfRPReg
.
R
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
bP
,
err
:=
hex
.
DecodeString
(
vrfRPReg
.
P
)
bP
,
err
:=
hex
.
DecodeString
(
vrfRPReg
.
P
)
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Info
(
"RegistVrf
M"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"M
is not correct"
,
logger
.
Info
(
"RegistVrf
RP"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"P
is not correct"
,
vrfRPReg
.
P
)
vrfRPReg
.
P
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
//todo 从localdb中查找对应的pubkey:cycle的信息,如果没找到,说明对应的M没有发布出来,则也不允许发布R,P。
vrfMTable
:=
dty
.
NewDposVrfMTable
(
action
.
localDB
)
query
:=
vrfMTable
.
GetQuery
(
action
.
localDB
)
rows
,
err
:=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
bPubkey
,
vrfRPReg
.
Cycle
)),
nil
,
1
,
0
)
if
err
!=
nil
{
logger
.
Error
(
"RegistVrfRP failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"VrfM is not exist"
,
vrfRPReg
.
String
())
return
nil
,
dty
.
ErrVrfMNotRegisted
}
//对于可以注册的R、P,则允许。
cycleInfo
:=
calcCycleByTime
(
action
.
blocktime
)
cycleInfo
:=
calcCycleByTime
(
action
.
blocktime
)
middleTime
:=
cycleInfo
.
cycleStart
+
(
cycleInfo
.
cycleStop
-
cycleInfo
.
cycleStart
)
/
2
//对于cycle不一致的情况,则不允许注册
//对于cycle不一致的情况,则不允许注册
if
vrfRPReg
.
Cycle
!=
cycleInfo
.
cycle
{
if
vrfRPReg
.
Cycle
!=
cycleInfo
.
cycle
{
logger
.
Error
(
"RegistVrfRP failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"cycle is not the same with current blocktime"
,
logger
.
Error
(
"RegistVrfRP failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"cycle is not the same with current blocktime"
,
vrfRPReg
.
String
())
vrfRPReg
.
String
())
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
else
if
action
.
blocktime
<
middleTime
{
logger
.
Error
(
"RegistVrfRP failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"time is not allowed, not over the middle of this cycle"
,
action
.
blocktime
,
"allow time"
,
fmt
.
Sprintf
(
"cycle:%d,start:%d,middle:%d,stop:%d"
,
cycleInfo
.
cycle
,
cycleInfo
.
cycleStart
,
middleTime
,
cycleInfo
.
cycleStop
))
return
nil
,
types
.
ErrInvalidParam
}
logger
.
Info
(
"RegistVrfRP"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"pubkey"
,
vrfRPReg
.
Pubkey
,
"cycle"
,
vrfRPReg
.
Cycle
,
"R"
,
vrfRPReg
.
R
,
"P"
,
vrfRPReg
.
P
,
"now"
,
action
.
blocktime
,
"info"
,
fmt
.
Sprintf
(
"cycle:%d,start:%d,middle:%d,stop:%d"
,
cycleInfo
.
cycle
,
cycleInfo
.
cycleStart
,
middleTime
,
cycleInfo
.
cycleStop
))
//从localdb中查找对应的pubkey:cycle的信息,如果没找到,说明对应的M没有发布出来,则也不允许发布R,P。
vrfMTable
:=
dty
.
NewDposVrfMTable
(
action
.
localDB
)
query
:=
vrfMTable
.
GetQuery
(
action
.
localDB
)
rows
,
err
:=
query
.
ListIndex
(
"pubkey_cycle"
,
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
bPubkey
,
vrfRPReg
.
Cycle
)),
nil
,
1
,
0
)
if
err
!=
nil
{
logger
.
Error
(
"RegistVrfRP failed"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"VrfM is not registered"
,
vrfRPReg
.
String
())
return
nil
,
dty
.
ErrVrfMNotRegisted
}
}
//对于可以注册的R、P,则允许。
//todo 还需要检查是否针对这个cycle已经有注册过R、P了,如果注册过了,也需要提示失败
//todo 还需要检查是否针对这个cycle已经有注册过R、P了,如果注册过了,也需要提示失败
VrfRPTable
:=
dty
.
NewDposVrfRPTable
(
action
.
localDB
)
VrfRPTable
:=
dty
.
NewDposVrfRPTable
(
action
.
localDB
)
...
@@ -877,6 +1037,9 @@ func (action *Action) RegistVrfRP(vrfRPReg *dty.DposVrfRPRegist) (*types.Receipt
...
@@ -877,6 +1037,9 @@ func (action *Action) RegistVrfRP(vrfRPReg *dty.DposVrfRPRegist) (*types.Receipt
r
.
P
=
bP
r
.
P
=
bP
r
.
M
=
rows
[
0
]
.
Data
.
(
*
dty
.
DposVrfM
)
.
M
r
.
M
=
rows
[
0
]
.
Data
.
(
*
dty
.
DposVrfM
)
.
M
r
.
Time
=
action
.
blocktime
r
.
Time
=
action
.
blocktime
r
.
CycleStart
=
cycleInfo
.
cycleStart
r
.
CycleStop
=
cycleInfo
.
cycleStop
r
.
CycleMiddle
=
middleTime
log
.
Ty
=
dty
.
TyLogVrfRPRegist
log
.
Ty
=
dty
.
TyLogVrfRPRegist
log
.
Log
=
types
.
Encode
(
r
)
log
.
Log
=
types
.
Encode
(
r
)
...
...
plugin/dapp/dposvote/executor/exec_del_local.go
View file @
1c6d4f4b
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
package
executor
package
executor
import
(
import
(
"bytes"
"fmt"
"fmt"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
...
@@ -23,22 +24,15 @@ func (d *DPos) rollbackCand(cand *dty.CandidatorInfo, log *dty.ReceiptCandicator
...
@@ -23,22 +24,15 @@ func (d *DPos) rollbackCand(cand *dty.CandidatorInfo, log *dty.ReceiptCandicator
}
}
//如果投票了,则需要把投票回滚
//如果投票了,则需要把投票回滚
if
log
.
Voted
{
if
log
.
VoteType
==
dty
.
VoteTypeVote
{
cand
.
Votes
-=
log
.
Votes
for
i
:=
0
;
i
<
len
(
cand
.
Voters
);
i
++
{
if
log
.
Votes
>
0
{
if
cand
.
Voters
[
i
]
.
Index
==
log
.
Vote
.
Index
&&
cand
.
Voters
[
i
]
.
FromAddr
==
log
.
Vote
.
FromAddr
&&
bytes
.
Equal
(
cand
.
Voters
[
i
]
.
Pubkey
,
log
.
Vote
.
Pubkey
){
//如果是投票,则回滚时将投票删除。
cand
.
Voters
=
append
(
cand
.
Voters
[
0
:
i
],
cand
.
Voters
[
i
+
1
:
]
...
)
cand
.
Voters
=
cand
.
Voters
[
:
len
(
cand
.
Voters
)
-
1
]
break
}
else
{
//如果是撤销投票,则回滚时,将删除的投票还回来
voter
:=
&
dty
.
DposVoter
{
FromAddr
:
log
.
FromAddr
,
Pubkey
:
log
.
Pubkey
,
Votes
:
-
log
.
Votes
,
Index
:
log
.
Index
,
Time
:
log
.
Time
-
dty
.
VoteFrozenTime
,
}
}
cand
.
Voters
=
append
(
cand
.
Voters
,
voter
)
}
}
}
else
if
log
.
VoteType
==
dty
.
VoteTypeCancelVote
{
cand
.
Voters
=
append
(
cand
.
Voters
,
log
.
Vote
)
}
}
}
}
...
@@ -74,10 +68,16 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
...
@@ -74,10 +68,16 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
return
nil
,
err
return
nil
,
err
}
}
//删除投票信息
if
log
.
VoteType
==
dty
.
VoteTypeVote
{
err
=
voterTable
.
Del
([]
byte
(
fmt
.
Sprintf
(
"%018d"
,
log
.
Index
)))
err
=
voterTable
.
Del
([]
byte
(
fmt
.
Sprintf
(
"%018d"
,
log
.
Index
)))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
else
if
log
.
VoteType
==
dty
.
VoteTypeCancelVote
{
err
=
voterTable
.
Add
(
log
.
Vote
)
if
err
!=
nil
{
return
nil
,
err
}
}
}
kvs2
,
err
:=
voterTable
.
Save
()
kvs2
,
err
:=
voterTable
.
Save
()
...
@@ -86,7 +86,7 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
...
@@ -86,7 +86,7 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
}
}
kvs
=
append
(
kvs1
,
kvs2
...
)
kvs
=
append
(
kvs1
,
kvs2
...
)
}
else
if
log
.
Status
==
dty
.
CandidatorStatusCancel
Voted
{
}
else
if
log
.
Status
==
dty
.
CandidatorStatusCancel
Regist
{
//撤销投票回滚,需要将撤销的投票还回来
//撤销投票回滚,需要将撤销的投票还回来
candInfo
:=
log
.
CandInfo
candInfo
:=
log
.
CandInfo
log
.
CandInfo
=
nil
log
.
CandInfo
=
nil
...
@@ -103,10 +103,13 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
...
@@ -103,10 +103,13 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
return
nil
,
err
return
nil
,
err
}
}
//删除投票信息
if
log
.
VoteType
==
dty
.
VoteTypeCancelAllVote
{
err
=
voterTable
.
Del
([]
byte
(
fmt
.
Sprintf
(
"%018d"
,
log
.
Index
)))
for
i
:=
0
;
i
<
len
(
candInfo
.
Voters
);
i
++
{
if
err
!=
nil
{
err
=
voterTable
.
Add
(
candInfo
.
Voters
[
i
])
return
nil
,
err
if
err
!=
nil
{
return
nil
,
err
}
}
}
}
kvs2
,
err
:=
voterTable
.
Save
()
kvs2
,
err
:=
voterTable
.
Save
()
...
@@ -115,6 +118,14 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
...
@@ -115,6 +118,14 @@ func (d *DPos) rollbackCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyVal
}
}
kvs
=
append
(
kvs1
,
kvs2
...
)
kvs
=
append
(
kvs1
,
kvs2
...
)
}
else
if
log
.
Status
==
dty
.
CandidatorStatusReRegist
{
//注册回滚,cand表删除记录
err
=
candTable
.
Del
(
log
.
Pubkey
)
if
err
!=
nil
{
return
nil
,
err
}
kvs
,
err
=
candTable
.
Save
()
return
kvs
,
err
}
}
return
kvs
,
nil
return
kvs
,
nil
...
@@ -153,7 +164,7 @@ func (d *DPos) execDelLocal(receipt *types.ReceiptData) (*types.LocalDBSet, erro
...
@@ -153,7 +164,7 @@ func (d *DPos) execDelLocal(receipt *types.ReceiptData) (*types.LocalDBSet, erro
for
_
,
log
:=
range
receipt
.
Logs
{
for
_
,
log
:=
range
receipt
.
Logs
{
switch
log
.
GetTy
()
{
switch
log
.
GetTy
()
{
case
dty
.
CandidatorStatusRegist
,
dty
.
CandidatorStatusVoted
,
dty
.
CandidatorStatusCancelVoted
,
dty
.
CandidatorStatusCancel
Regist
:
case
dty
.
TyLogCandicatorRegist
,
dty
.
TyLogCandicatorVoted
,
dty
.
TyLogCandicatorCancelVoted
,
dty
.
TyLogCandicatorCancelRegist
,
dty
.
TyLogCandicatorRe
Regist
:
receiptLog
:=
&
dty
.
ReceiptCandicator
{}
receiptLog
:=
&
dty
.
ReceiptCandicator
{}
if
err
:=
types
.
Decode
(
log
.
Log
,
receiptLog
);
err
!=
nil
{
if
err
:=
types
.
Decode
(
log
.
Log
,
receiptLog
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
plugin/dapp/dposvote/executor/exec_local.go
View file @
1c6d4f4b
...
@@ -7,16 +7,17 @@ package executor
...
@@ -7,16 +7,17 @@ package executor
import
(
import
(
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
dty
"github.com/33cn/plugin/plugin/dapp/dposvote/types"
dty
"github.com/33cn/plugin/plugin/dapp/dposvote/types"
"fmt"
)
)
func
(
d
*
DPos
)
updateCandVote
(
log
*
dty
.
ReceiptCandicator
)
(
kvs
[]
*
types
.
KeyValue
,
err
error
)
{
func
(
d
*
DPos
)
updateCandVote
(
log
*
dty
.
ReceiptCandicator
)
(
kvs
[]
*
types
.
KeyValue
,
err
error
)
{
voteTable
:=
dty
.
NewDposVoteTable
(
d
.
GetLocalDB
())
voteTable
:=
dty
.
NewDposVoteTable
(
d
.
GetLocalDB
())
canTable
:=
dty
.
NewDposCandidatorTable
(
d
.
GetLocalDB
())
canTable
:=
dty
.
NewDposCandidatorTable
(
d
.
GetLocalDB
())
if
log
.
Status
==
dty
.
CandidatorStatusRegist
{
candInfo
:=
log
.
CandInfo
candInfo
:=
log
.
CandInfo
log
.
CandInfo
=
nil
log
.
CandInfo
=
nil
if
log
.
Status
==
dty
.
CandidatorStatusRegist
{
err
=
canTable
.
Add
(
candInfo
)
err
=
canTable
.
Add
(
candInfo
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -27,9 +28,7 @@ func (d *DPos) updateCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyValue
...
@@ -27,9 +28,7 @@ func (d *DPos) updateCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyValue
return
nil
,
err
return
nil
,
err
}
}
}
else
if
log
.
Status
==
dty
.
CandidatorStatusVoted
{
}
else
if
log
.
Status
==
dty
.
CandidatorStatusVoted
{
candInfo
:=
log
.
CandInfo
voter
:=
log
.
Vote
log
.
CandInfo
=
nil
voter
:=
candInfo
.
Voters
[
len
(
candInfo
.
Voters
)
-
1
]
err
=
canTable
.
Replace
(
candInfo
)
err
=
canTable
.
Replace
(
candInfo
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -41,9 +40,16 @@ func (d *DPos) updateCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyValue
...
@@ -41,9 +40,16 @@ func (d *DPos) updateCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyValue
return
nil
,
err
return
nil
,
err
}
}
err
=
voteTable
.
Add
(
voter
)
if
log
.
VoteType
==
dty
.
VoteTypeVote
{
if
err
!=
nil
{
err
=
voteTable
.
Add
(
voter
)
return
nil
,
err
if
err
!=
nil
{
return
nil
,
err
}
}
else
if
log
.
VoteType
==
dty
.
VoteTypeCancelVote
{
err
=
voteTable
.
Del
([]
byte
(
fmt
.
Sprintf
(
"%018d"
,
voter
.
Index
)))
if
err
!=
nil
{
return
nil
,
err
}
}
}
kvs2
,
err
:=
voteTable
.
Save
()
kvs2
,
err
:=
voteTable
.
Save
()
...
@@ -52,51 +58,40 @@ func (d *DPos) updateCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyValue
...
@@ -52,51 +58,40 @@ func (d *DPos) updateCandVote(log *dty.ReceiptCandicator) (kvs []*types.KeyValue
}
}
kvs
=
append
(
kvs1
,
kvs2
...
)
kvs
=
append
(
kvs1
,
kvs2
...
)
}
else
if
log
.
Status
==
dty
.
CandidatorStatusCancelVoted
{
}
else
if
log
.
Status
==
dty
.
CandidatorStatusReRegist
{
candInfo
:=
log
.
CandInfo
log
.
CandInfo
=
nil
voter
:=
&
dty
.
DposVoter
{
FromAddr
:
log
.
FromAddr
,
Pubkey
:
log
.
Pubkey
,
Votes
:
log
.
Votes
,
Index
:
log
.
Index
,
Time
:
log
.
Time
,
}
err
=
canTable
.
Replace
(
candInfo
)
err
=
canTable
.
Replace
(
candInfo
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kvs
1
,
err
:
=
canTable
.
Save
()
kvs
,
err
=
canTable
.
Save
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
}
else
if
log
.
Status
==
dty
.
CandidatorStatusCancelRegist
{
err
=
voteTable
.
Add
(
voter
)
err
=
canTable
.
Replace
(
candInfo
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kvs
2
,
err
:=
vote
Table
.
Save
()
kvs
1
,
err
:=
can
Table
.
Save
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kvs
=
append
(
kvs1
,
kvs2
...
)
for
i
:=
0
;
i
<
len
(
candInfo
.
Voters
);
i
++
{
}
else
if
log
.
Status
==
dty
.
CandidatorStatusReRegist
||
log
.
Status
==
dty
.
CandidatorStatusCancelRegist
{
err
=
voteTable
.
Del
([]
byte
(
fmt
.
Sprintf
(
"%018d"
,
candInfo
.
Voters
[
i
]
.
Index
)))
candInfo
:=
log
.
CandInfo
if
err
!=
nil
{
log
.
CandInfo
=
nil
return
nil
,
err
}
err
=
canTable
.
Replace
(
candInfo
)
if
err
!=
nil
{
return
nil
,
err
}
}
kvs
,
err
=
can
Table
.
Save
()
kvs
2
,
err
:=
vote
Table
.
Save
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kvs
=
append
(
kvs1
,
kvs2
...
)
}
}
return
kvs
,
nil
return
kvs
,
nil
...
@@ -112,6 +107,9 @@ func (d *DPos) updateVrf(log *dty.ReceiptVrf) (kvs []*types.KeyValue, err error)
...
@@ -112,6 +107,9 @@ func (d *DPos) updateVrf(log *dty.ReceiptVrf) (kvs []*types.KeyValue, err error)
Height
:
log
.
Height
,
Height
:
log
.
Height
,
M
:
log
.
M
,
M
:
log
.
M
,
Time
:
log
.
Time
,
Time
:
log
.
Time
,
CycleStart
:
log
.
CycleStart
,
CycleMiddle
:
log
.
CycleMiddle
,
CycleStop
:
log
.
CycleStop
,
}
}
err
=
vrfMTable
.
Add
(
vrfM
)
err
=
vrfMTable
.
Add
(
vrfM
)
...
@@ -134,6 +132,9 @@ func (d *DPos) updateVrf(log *dty.ReceiptVrf) (kvs []*types.KeyValue, err error)
...
@@ -134,6 +132,9 @@ func (d *DPos) updateVrf(log *dty.ReceiptVrf) (kvs []*types.KeyValue, err error)
P
:
log
.
P
,
P
:
log
.
P
,
M
:
log
.
M
,
M
:
log
.
M
,
Time
:
log
.
Time
,
Time
:
log
.
Time
,
CycleStart
:
log
.
CycleStart
,
CycleMiddle
:
log
.
CycleMiddle
,
CycleStop
:
log
.
CycleStop
,
}
}
err
=
VrfRPTable
.
Add
(
vrfRP
)
err
=
VrfRPTable
.
Add
(
vrfRP
)
...
@@ -211,11 +212,11 @@ func (d *DPos) ExecLocal_CancelVote(payload *dty.DposCancelVote, tx *types.Trans
...
@@ -211,11 +212,11 @@ func (d *DPos) ExecLocal_CancelVote(payload *dty.DposCancelVote, tx *types.Trans
}
}
//ExecLocal_VrfMRegist method
//ExecLocal_VrfMRegist method
func
(
d
*
DPos
)
ExecLocal_
VrfMRegist
(
payload
*
dty
.
DposVrfMRegist
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
func
(
d
*
DPos
)
ExecLocal_
RegistVrfM
(
payload
*
dty
.
DposVrfMRegist
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
d
.
execLocal
(
receiptData
)
return
d
.
execLocal
(
receiptData
)
}
}
//ExecLocal_VrfRPRegist method
//ExecLocal_VrfRPRegist method
func
(
d
*
DPos
)
ExecLocal_
VrfRPRegist
(
payload
*
dty
.
DposVrfRPRegist
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
func
(
d
*
DPos
)
ExecLocal_
RegistVrfRP
(
payload
*
dty
.
DposVrfRPRegist
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
d
.
execLocal
(
receiptData
)
return
d
.
execLocal
(
receiptData
)
}
}
\ No newline at end of file
plugin/dapp/dposvote/executor/query.go
View file @
1c6d4f4b
...
@@ -33,3 +33,13 @@ func (d *DPos) Query_QueryVrfByTime(in *dty.DposVrfQuery) (types.Message, error)
...
@@ -33,3 +33,13 @@ func (d *DPos) Query_QueryVrfByTime(in *dty.DposVrfQuery) (types.Message, error)
func
(
d
*
DPos
)
Query_QueryVrfByCycle
(
in
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
func
(
d
*
DPos
)
Query_QueryVrfByCycle
(
in
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
return
queryVrfByCycle
(
d
.
GetLocalDB
(),
in
)
return
queryVrfByCycle
(
d
.
GetLocalDB
(),
in
)
}
}
//Query_QueryVrfByCycleForTopN method
func
(
d
*
DPos
)
Query_QueryVrfByCycleForTopN
(
in
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
return
queryVrfByCycleForTopN
(
d
.
GetLocalDB
(),
in
)
}
//Query_QueryVrfByCycleForPubkeys method
func
(
d
*
DPos
)
Query_QueryVrfByCycleForPubkeys
(
in
*
dty
.
DposVrfQuery
)
(
types
.
Message
,
error
)
{
return
queryVrfByCycleForPubkeys
(
d
.
GetLocalDB
(),
in
)
}
\ No newline at end of file
plugin/dapp/dposvote/proto/dposvote.proto
View file @
1c6d4f4b
...
@@ -39,27 +39,27 @@ message Candidator {
...
@@ -39,27 +39,27 @@ message Candidator {
//DposCandidatorRegist 注册Dpos候选节点,必须抵押一定数量的币,比如:10000个币
//DposCandidatorRegist 注册Dpos候选节点,必须抵押一定数量的币,比如:10000个币
message
DposCandidatorRegist
{
message
DposCandidatorRegist
{
string
pubkey
=
1
;
//候选节点的公钥
string
pubkey
=
1
;
//候选节点的公钥
string
address
=
2
;
//候选节点的地址
string
address
=
2
;
//候选节点的地址
string
ip
=
3
;
//候选节点的共识IP地址
string
ip
=
3
;
//候选节点的共识IP地址
}
}
//DposCandidatorCancelRegist 注销Dpos候选节点,解冻抵押的币
//DposCandidatorCancelRegist 注销Dpos候选节点,解冻抵押的币
message
DposCandidatorCancelRegist
{
message
DposCandidatorCancelRegist
{
string
pubkey
=
1
;
//候选节点的公钥
string
pubkey
=
1
;
//候选节点的公钥
string
address
=
2
;
//候选节点的地址
string
address
=
2
;
//候选节点的地址
}
}
//DposVote 为Dpos候选节点投票
//DposVote 为Dpos候选节点投票
message
DposVote
{
message
DposVote
{
string
fromAddr
=
1
;
string
fromAddr
=
1
;
string
pubkey
=
2
;
//候选节点的公钥
string
pubkey
=
2
;
//候选节点的公钥
int64
votes
=
3
;
//投给候选节点的票数,不能超过锁在合约中的未使用票数
int64
votes
=
3
;
//投给候选节点的票数,不能超过锁在合约中的未使用票数
}
}
//DposCancelVote 撤销为Dpos候选节点投票
//DposCancelVote 撤销为Dpos候选节点投票
message
DposCancelVote
{
message
DposCancelVote
{
string
pubkey
=
1
;
//候选节点的公钥
string
pubkey
=
1
;
//候选节点的公钥
int64
votes
=
2
;
//撤销投给候选节点的票数,不超过之前投给该候选节点的总票数,投票3天之后才可以撤销投票
int64
index
=
3
;
}
}
//DposVoteAction DposVote动作
//DposVoteAction DposVote动作
...
@@ -85,8 +85,18 @@ message CandidatorQuery{
...
@@ -85,8 +85,18 @@ message CandidatorQuery{
int32
ty
=
3
;
//1:按公钥集合查询,2:按topN票数查询
int32
ty
=
3
;
//1:按公钥集合查询,2:按topN票数查询
}
}
//Candidator 候选节点信息
message
JsonCandidator
{
string
pubkey
=
1
;
//候选节点的公钥
string
address
=
2
;
//后续节点的地址
string
ip
=
3
;
//候选节点的运行IP
int64
votes
=
4
;
//候选节点的投票数
int64
status
=
5
;
//候选节点的状态,0:注册,1:当选,2:取消注册
}
message
CandidatorReply
{
message
CandidatorReply
{
repeated
Candidator
candidators
=
1
;
//候选节点
repeated
Json
Candidator
candidators
=
1
;
//候选节点
}
}
message
DposVoteQuery
{
message
DposVoteQuery
{
...
@@ -94,8 +104,16 @@ message DposVoteQuery{
...
@@ -94,8 +104,16 @@ message DposVoteQuery{
string
addr
=
2
;
//要查询的地址
string
addr
=
2
;
//要查询的地址
}
}
message
JsonDposVoter
{
string
fromAddr
=
1
;
string
pubkey
=
2
;
//候选节点的公钥
int64
votes
=
3
;
//投给候选节点的票数,不能超过锁在合约中的未使用票数
int64
index
=
4
;
int64
time
=
5
;
}
message
DposVoteReply
{
message
DposVoteReply
{
repeated
DposVoter
votes
=
1
;
//某地址对具体候选节点的投票情况
repeated
Json
DposVoter
votes
=
1
;
//某地址对具体候选节点的投票情况
}
}
//ReceiptCandicator 候选者收据信息
//ReceiptCandicator 候选者收据信息
...
@@ -106,8 +124,8 @@ message ReceiptCandicator {
...
@@ -106,8 +124,8 @@ message ReceiptCandicator {
int64
status
=
4
;
int64
status
=
4
;
int64
preStatus
=
5
;
int64
preStatus
=
5
;
bool
statusChange
=
6
;
bool
statusChange
=
6
;
bool
voted
=
7
;
int32
voteType
=
7
;
int64
votes
=
8
;
DposVoter
vote
=
8
;
string
fromAddr
=
9
;
string
fromAddr
=
9
;
CandidatorInfo
candInfo
=
10
;
CandidatorInfo
candInfo
=
10
;
int64
time
=
11
;
int64
time
=
11
;
...
@@ -120,6 +138,9 @@ message DposVrfM{
...
@@ -120,6 +138,9 @@ message DposVrfM{
int64
height
=
4
;
int64
height
=
4
;
bytes
m
=
5
;
//vrf的输入
bytes
m
=
5
;
//vrf的输入
int64
time
=
6
;
int64
time
=
6
;
int64
cycleStart
=
7
;
int64
cycleMiddle
=
8
;
int64
cycleStop
=
9
;
}
}
message
DposVrfRP
{
message
DposVrfRP
{
...
@@ -131,6 +152,9 @@ message DposVrfRP{
...
@@ -131,6 +152,9 @@ message DposVrfRP{
bytes
r
=
6
;
//vrf的hash
bytes
r
=
6
;
//vrf的hash
bytes
p
=
7
;
//vrf的hash的proof
bytes
p
=
7
;
//vrf的hash的proof
int64
time
=
8
;
int64
time
=
8
;
int64
cycleStart
=
9
;
int64
cycleMiddle
=
10
;
int64
cycleStop
=
11
;
}
}
message
DposVrfMRegist
{
message
DposVrfMRegist
{
...
@@ -158,6 +182,9 @@ message ReceiptVrf {
...
@@ -158,6 +182,9 @@ message ReceiptVrf {
bytes
r
=
7
;
bytes
r
=
7
;
bytes
p
=
8
;
bytes
p
=
8
;
int64
time
=
9
;
int64
time
=
9
;
int64
cycleStart
=
10
;
int64
cycleMiddle
=
11
;
int64
cycleStop
=
12
;
}
}
...
@@ -173,11 +200,23 @@ message VrfInfo {
...
@@ -173,11 +200,23 @@ message VrfInfo {
}
}
message
DposVrfQuery
{
message
DposVrfQuery
{
int64
ty
=
1
;
repeated
string
pubkeys
=
1
;
int64
timestamp
=
2
;
int64
ty
=
2
;
int64
cycle
=
3
;
int64
timestamp
=
3
;
int64
cycle
=
4
;
}
message
JsonVrfInfo
{
int64
Index
=
1
;
string
pubkey
=
2
;
int64
cycle
=
4
;
int64
height
=
5
;
string
m
=
6
;
string
r
=
7
;
string
p
=
8
;
int64
time
=
9
;
}
}
message
DposVrfReply
{
message
DposVrfReply
{
repeated
VrfInfo
vrf
=
1
;
repeated
Json
VrfInfo
vrf
=
1
;
}
}
\ No newline at end of file
plugin/dapp/dposvote/types/const.go
View file @
1c6d4f4b
...
@@ -38,6 +38,11 @@ const (
...
@@ -38,6 +38,11 @@ const (
const
(
const
(
VoteFrozenTime
=
3
*
24
*
3600
VoteFrozenTime
=
3
*
24
*
3600
RegistFrozenCoins
=
1000000000000
RegistFrozenCoins
=
1000000000000
VoteTypeNone
int32
=
1
VoteTypeVote
int32
=
2
VoteTypeCancelVote
int32
=
3
VoteTypeCancelAllVote
int32
=
4
)
)
//包的名字可以通过配置文件来配置
//包的名字可以通过配置文件来配置
//建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字
//建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字
...
@@ -60,6 +65,12 @@ const (
...
@@ -60,6 +65,12 @@ const (
//FuncNameQueryVrfByCycle func name
//FuncNameQueryVrfByCycle func name
FuncNameQueryVrfByCycle
=
"QueryVrfByCycle"
FuncNameQueryVrfByCycle
=
"QueryVrfByCycle"
//FuncNameQueryVrfByCycleForTopN func name
FuncNameQueryVrfByCycleForTopN
=
"QueryVrfByCycleForTopN"
//FuncNameQueryVrfByCycleForPubkeys func name
FuncNameQueryVrfByCycleForPubkeys
=
"QueryVrfByCycleForPubkeys"
//FuncNameQueryVote func name
//FuncNameQueryVote func name
FuncNameQueryVote
=
"QueryVote"
FuncNameQueryVote
=
"QueryVote"
...
@@ -84,9 +95,15 @@ const (
...
@@ -84,9 +95,15 @@ const (
//CreateRegistVrfRPTx 创建注册Vrf的R/P信息的交易
//CreateRegistVrfRPTx 创建注册Vrf的R/P信息的交易
CreateRegistVrfRPTx
=
"RegistVrfRP"
CreateRegistVrfRPTx
=
"RegistVrfRP"
//QueryVrfByTime 创建根据time查询Vrf信息
查询
//QueryVrfByTime 创建根据time查询Vrf信息
QueryVrfByTime
=
1
QueryVrfByTime
=
1
//QueryVrfByCycle 创建根据cycle查询Vrf信息
查询
//QueryVrfByCycle 创建根据cycle查询Vrf信息
QueryVrfByCycle
=
2
QueryVrfByCycle
=
2
//QueryVrfByCycleForTopN 创建根据cycle查询当前topN的候选节点的Vrf信息
QueryVrfByCycleForTopN
=
3
//QueryVrfByCycleForPubkeys 创建根据cycle查询指定pubkey的多个候选节点的Vrf信息
QueryVrfByCycleForPubkeys
=
4
)
)
plugin/dapp/dposvote/types/dposvote.pb.go
View file @
1c6d4f4b
...
@@ -17,8 +17,10 @@ It has these top-level messages:
...
@@ -17,8 +17,10 @@ It has these top-level messages:
DposCancelVote
DposCancelVote
DposVoteAction
DposVoteAction
CandidatorQuery
CandidatorQuery
JsonCandidator
CandidatorReply
CandidatorReply
DposVoteQuery
DposVoteQuery
JsonDposVoter
DposVoteReply
DposVoteReply
ReceiptCandicator
ReceiptCandicator
DposVrfM
DposVrfM
...
@@ -28,6 +30,7 @@ It has these top-level messages:
...
@@ -28,6 +30,7 @@ It has these top-level messages:
ReceiptVrf
ReceiptVrf
VrfInfo
VrfInfo
DposVrfQuery
DposVrfQuery
JsonVrfInfo
DposVrfReply
DposVrfReply
*/
*/
package
types
package
types
...
@@ -351,7 +354,7 @@ func (m *DposVote) GetVotes() int64 {
...
@@ -351,7 +354,7 @@ func (m *DposVote) GetVotes() int64 {
// DposCancelVote 撤销为Dpos候选节点投票
// DposCancelVote 撤销为Dpos候选节点投票
type
DposCancelVote
struct
{
type
DposCancelVote
struct
{
Pubkey
string
`protobuf:"bytes,1,opt,name=pubkey" json:"pubkey,omitempty"`
Pubkey
string
`protobuf:"bytes,1,opt,name=pubkey" json:"pubkey,omitempty"`
Votes
int64
`protobuf:"varint,2,opt,name=votes" json:"votes
,omitempty"`
Index
int64
`protobuf:"varint,3,opt,name=index" json:"index
,omitempty"`
}
}
func
(
m
*
DposCancelVote
)
Reset
()
{
*
m
=
DposCancelVote
{}
}
func
(
m
*
DposCancelVote
)
Reset
()
{
*
m
=
DposCancelVote
{}
}
...
@@ -366,9 +369,9 @@ func (m *DposCancelVote) GetPubkey() string {
...
@@ -366,9 +369,9 @@ func (m *DposCancelVote) GetPubkey() string {
return
""
return
""
}
}
func
(
m
*
DposCancelVote
)
Get
Votes
()
int64
{
func
(
m
*
DposCancelVote
)
Get
Index
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Votes
return
m
.
Index
}
}
return
0
return
0
}
}
...
@@ -783,16 +786,65 @@ func (m *CandidatorQuery) GetTy() int32 {
...
@@ -783,16 +786,65 @@ func (m *CandidatorQuery) GetTy() int32 {
return
0
return
0
}
}
// Candidator 候选节点信息
type
JsonCandidator
struct
{
Pubkey
string
`protobuf:"bytes,1,opt,name=pubkey" json:"pubkey,omitempty"`
Address
string
`protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
Ip
string
`protobuf:"bytes,3,opt,name=ip" json:"ip,omitempty"`
Votes
int64
`protobuf:"varint,4,opt,name=votes" json:"votes,omitempty"`
Status
int64
`protobuf:"varint,5,opt,name=status" json:"status,omitempty"`
}
func
(
m
*
JsonCandidator
)
Reset
()
{
*
m
=
JsonCandidator
{}
}
func
(
m
*
JsonCandidator
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
JsonCandidator
)
ProtoMessage
()
{}
func
(
*
JsonCandidator
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
9
}
}
func
(
m
*
JsonCandidator
)
GetPubkey
()
string
{
if
m
!=
nil
{
return
m
.
Pubkey
}
return
""
}
func
(
m
*
JsonCandidator
)
GetAddress
()
string
{
if
m
!=
nil
{
return
m
.
Address
}
return
""
}
func
(
m
*
JsonCandidator
)
GetIp
()
string
{
if
m
!=
nil
{
return
m
.
Ip
}
return
""
}
func
(
m
*
JsonCandidator
)
GetVotes
()
int64
{
if
m
!=
nil
{
return
m
.
Votes
}
return
0
}
func
(
m
*
JsonCandidator
)
GetStatus
()
int64
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
type
CandidatorReply
struct
{
type
CandidatorReply
struct
{
Candidators
[]
*
Candidator
`protobuf:"bytes,1,rep,name=candidators" json:"candidators,omitempty"`
Candidators
[]
*
Json
Candidator
`protobuf:"bytes,1,rep,name=candidators" json:"candidators,omitempty"`
}
}
func
(
m
*
CandidatorReply
)
Reset
()
{
*
m
=
CandidatorReply
{}
}
func
(
m
*
CandidatorReply
)
Reset
()
{
*
m
=
CandidatorReply
{}
}
func
(
m
*
CandidatorReply
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
CandidatorReply
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
CandidatorReply
)
ProtoMessage
()
{}
func
(
*
CandidatorReply
)
ProtoMessage
()
{}
func
(
*
CandidatorReply
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
9
}
}
func
(
*
CandidatorReply
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
10
}
}
func
(
m
*
CandidatorReply
)
GetCandidators
()
[]
*
Candidator
{
func
(
m
*
CandidatorReply
)
GetCandidators
()
[]
*
Json
Candidator
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Candidators
return
m
.
Candidators
}
}
...
@@ -807,7 +859,7 @@ type DposVoteQuery struct {
...
@@ -807,7 +859,7 @@ type DposVoteQuery struct {
func
(
m
*
DposVoteQuery
)
Reset
()
{
*
m
=
DposVoteQuery
{}
}
func
(
m
*
DposVoteQuery
)
Reset
()
{
*
m
=
DposVoteQuery
{}
}
func
(
m
*
DposVoteQuery
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVoteQuery
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVoteQuery
)
ProtoMessage
()
{}
func
(
*
DposVoteQuery
)
ProtoMessage
()
{}
func
(
*
DposVoteQuery
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
0
}
}
func
(
*
DposVoteQuery
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
1
}
}
func
(
m
*
DposVoteQuery
)
GetPubkeys
()
[]
string
{
func
(
m
*
DposVoteQuery
)
GetPubkeys
()
[]
string
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -823,16 +875,64 @@ func (m *DposVoteQuery) GetAddr() string {
...
@@ -823,16 +875,64 @@ func (m *DposVoteQuery) GetAddr() string {
return
""
return
""
}
}
type
JsonDposVoter
struct
{
FromAddr
string
`protobuf:"bytes,1,opt,name=fromAddr" json:"fromAddr,omitempty"`
Pubkey
string
`protobuf:"bytes,2,opt,name=pubkey" json:"pubkey,omitempty"`
Votes
int64
`protobuf:"varint,3,opt,name=votes" json:"votes,omitempty"`
Index
int64
`protobuf:"varint,4,opt,name=index" json:"index,omitempty"`
Time
int64
`protobuf:"varint,5,opt,name=time" json:"time,omitempty"`
}
func
(
m
*
JsonDposVoter
)
Reset
()
{
*
m
=
JsonDposVoter
{}
}
func
(
m
*
JsonDposVoter
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
JsonDposVoter
)
ProtoMessage
()
{}
func
(
*
JsonDposVoter
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
12
}
}
func
(
m
*
JsonDposVoter
)
GetFromAddr
()
string
{
if
m
!=
nil
{
return
m
.
FromAddr
}
return
""
}
func
(
m
*
JsonDposVoter
)
GetPubkey
()
string
{
if
m
!=
nil
{
return
m
.
Pubkey
}
return
""
}
func
(
m
*
JsonDposVoter
)
GetVotes
()
int64
{
if
m
!=
nil
{
return
m
.
Votes
}
return
0
}
func
(
m
*
JsonDposVoter
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
func
(
m
*
JsonDposVoter
)
GetTime
()
int64
{
if
m
!=
nil
{
return
m
.
Time
}
return
0
}
type
DposVoteReply
struct
{
type
DposVoteReply
struct
{
Votes
[]
*
DposVoter
`protobuf:"bytes,1,rep,name=votes" json:"votes,omitempty"`
Votes
[]
*
Json
DposVoter
`protobuf:"bytes,1,rep,name=votes" json:"votes,omitempty"`
}
}
func
(
m
*
DposVoteReply
)
Reset
()
{
*
m
=
DposVoteReply
{}
}
func
(
m
*
DposVoteReply
)
Reset
()
{
*
m
=
DposVoteReply
{}
}
func
(
m
*
DposVoteReply
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVoteReply
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVoteReply
)
ProtoMessage
()
{}
func
(
*
DposVoteReply
)
ProtoMessage
()
{}
func
(
*
DposVoteReply
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
1
}
}
func
(
*
DposVoteReply
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
3
}
}
func
(
m
*
DposVoteReply
)
GetVotes
()
[]
*
DposVoter
{
func
(
m
*
DposVoteReply
)
GetVotes
()
[]
*
Json
DposVoter
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Votes
return
m
.
Votes
}
}
...
@@ -847,8 +947,8 @@ type ReceiptCandicator struct {
...
@@ -847,8 +947,8 @@ type ReceiptCandicator struct {
Status
int64
`protobuf:"varint,4,opt,name=status" json:"status,omitempty"`
Status
int64
`protobuf:"varint,4,opt,name=status" json:"status,omitempty"`
PreStatus
int64
`protobuf:"varint,5,opt,name=preStatus" json:"preStatus,omitempty"`
PreStatus
int64
`protobuf:"varint,5,opt,name=preStatus" json:"preStatus,omitempty"`
StatusChange
bool
`protobuf:"varint,6,opt,name=statusChange" json:"statusChange,omitempty"`
StatusChange
bool
`protobuf:"varint,6,opt,name=statusChange" json:"statusChange,omitempty"`
Vote
d
bool
`protobuf:"varint,7,opt,name=voted" json:"voted
,omitempty"`
Vote
Type
int32
`protobuf:"varint,7,opt,name=voteType" json:"voteType
,omitempty"`
Vote
s
int64
`protobuf:"varint,8,opt,name=votes" json:"votes
,omitempty"`
Vote
*
DposVoter
`protobuf:"bytes,8,opt,name=vote" json:"vote
,omitempty"`
FromAddr
string
`protobuf:"bytes,9,opt,name=fromAddr" json:"fromAddr,omitempty"`
FromAddr
string
`protobuf:"bytes,9,opt,name=fromAddr" json:"fromAddr,omitempty"`
CandInfo
*
CandidatorInfo
`protobuf:"bytes,10,opt,name=candInfo" json:"candInfo,omitempty"`
CandInfo
*
CandidatorInfo
`protobuf:"bytes,10,opt,name=candInfo" json:"candInfo,omitempty"`
Time
int64
`protobuf:"varint,11,opt,name=time" json:"time,omitempty"`
Time
int64
`protobuf:"varint,11,opt,name=time" json:"time,omitempty"`
...
@@ -857,7 +957,7 @@ type ReceiptCandicator struct {
...
@@ -857,7 +957,7 @@ type ReceiptCandicator struct {
func
(
m
*
ReceiptCandicator
)
Reset
()
{
*
m
=
ReceiptCandicator
{}
}
func
(
m
*
ReceiptCandicator
)
Reset
()
{
*
m
=
ReceiptCandicator
{}
}
func
(
m
*
ReceiptCandicator
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReceiptCandicator
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptCandicator
)
ProtoMessage
()
{}
func
(
*
ReceiptCandicator
)
ProtoMessage
()
{}
func
(
*
ReceiptCandicator
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
2
}
}
func
(
*
ReceiptCandicator
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
4
}
}
func
(
m
*
ReceiptCandicator
)
GetIndex
()
int64
{
func
(
m
*
ReceiptCandicator
)
GetIndex
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -901,18 +1001,18 @@ func (m *ReceiptCandicator) GetStatusChange() bool {
...
@@ -901,18 +1001,18 @@ func (m *ReceiptCandicator) GetStatusChange() bool {
return
false
return
false
}
}
func
(
m
*
ReceiptCandicator
)
GetVote
d
()
bool
{
func
(
m
*
ReceiptCandicator
)
GetVote
Type
()
int32
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Vote
d
return
m
.
Vote
Type
}
}
return
false
return
0
}
}
func
(
m
*
ReceiptCandicator
)
GetVote
s
()
int64
{
func
(
m
*
ReceiptCandicator
)
GetVote
()
*
DposVoter
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Vote
s
return
m
.
Vote
}
}
return
0
return
nil
}
}
func
(
m
*
ReceiptCandicator
)
GetFromAddr
()
string
{
func
(
m
*
ReceiptCandicator
)
GetFromAddr
()
string
{
...
@@ -937,18 +1037,21 @@ func (m *ReceiptCandicator) GetTime() int64 {
...
@@ -937,18 +1037,21 @@ func (m *ReceiptCandicator) GetTime() int64 {
}
}
type
DposVrfM
struct
{
type
DposVrfM
struct
{
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Cycle
int64
`protobuf:"varint,3,opt,name=cycle" json:"cycle,omitempty"`
Cycle
int64
`protobuf:"varint,3,opt,name=cycle" json:"cycle,omitempty"`
Height
int64
`protobuf:"varint,4,opt,name=height" json:"height,omitempty"`
Height
int64
`protobuf:"varint,4,opt,name=height" json:"height,omitempty"`
M
[]
byte
`protobuf:"bytes,5,opt,name=m,proto3" json:"m,omitempty"`
M
[]
byte
`protobuf:"bytes,5,opt,name=m,proto3" json:"m,omitempty"`
Time
int64
`protobuf:"varint,6,opt,name=time" json:"time,omitempty"`
Time
int64
`protobuf:"varint,6,opt,name=time" json:"time,omitempty"`
CycleStart
int64
`protobuf:"varint,7,opt,name=cycleStart" json:"cycleStart,omitempty"`
CycleMiddle
int64
`protobuf:"varint,8,opt,name=cycleMiddle" json:"cycleMiddle,omitempty"`
CycleStop
int64
`protobuf:"varint,9,opt,name=cycleStop" json:"cycleStop,omitempty"`
}
}
func
(
m
*
DposVrfM
)
Reset
()
{
*
m
=
DposVrfM
{}
}
func
(
m
*
DposVrfM
)
Reset
()
{
*
m
=
DposVrfM
{}
}
func
(
m
*
DposVrfM
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVrfM
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVrfM
)
ProtoMessage
()
{}
func
(
*
DposVrfM
)
ProtoMessage
()
{}
func
(
*
DposVrfM
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
3
}
}
func
(
*
DposVrfM
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
5
}
}
func
(
m
*
DposVrfM
)
GetIndex
()
int64
{
func
(
m
*
DposVrfM
)
GetIndex
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -992,21 +1095,45 @@ func (m *DposVrfM) GetTime() int64 {
...
@@ -992,21 +1095,45 @@ func (m *DposVrfM) GetTime() int64 {
return
0
return
0
}
}
func
(
m
*
DposVrfM
)
GetCycleStart
()
int64
{
if
m
!=
nil
{
return
m
.
CycleStart
}
return
0
}
func
(
m
*
DposVrfM
)
GetCycleMiddle
()
int64
{
if
m
!=
nil
{
return
m
.
CycleMiddle
}
return
0
}
func
(
m
*
DposVrfM
)
GetCycleStop
()
int64
{
if
m
!=
nil
{
return
m
.
CycleStop
}
return
0
}
type
DposVrfRP
struct
{
type
DposVrfRP
struct
{
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Cycle
int64
`protobuf:"varint,3,opt,name=cycle" json:"cycle,omitempty"`
Cycle
int64
`protobuf:"varint,3,opt,name=cycle" json:"cycle,omitempty"`
Height
int64
`protobuf:"varint,4,opt,name=height" json:"height,omitempty"`
Height
int64
`protobuf:"varint,4,opt,name=height" json:"height,omitempty"`
M
[]
byte
`protobuf:"bytes,5,opt,name=m,proto3" json:"m,omitempty"`
M
[]
byte
`protobuf:"bytes,5,opt,name=m,proto3" json:"m,omitempty"`
R
[]
byte
`protobuf:"bytes,6,opt,name=r,proto3" json:"r,omitempty"`
R
[]
byte
`protobuf:"bytes,6,opt,name=r,proto3" json:"r,omitempty"`
P
[]
byte
`protobuf:"bytes,7,opt,name=p,proto3" json:"p,omitempty"`
P
[]
byte
`protobuf:"bytes,7,opt,name=p,proto3" json:"p,omitempty"`
Time
int64
`protobuf:"varint,8,opt,name=time" json:"time,omitempty"`
Time
int64
`protobuf:"varint,8,opt,name=time" json:"time,omitempty"`
CycleStart
int64
`protobuf:"varint,9,opt,name=cycleStart" json:"cycleStart,omitempty"`
CycleMiddle
int64
`protobuf:"varint,10,opt,name=cycleMiddle" json:"cycleMiddle,omitempty"`
CycleStop
int64
`protobuf:"varint,11,opt,name=cycleStop" json:"cycleStop,omitempty"`
}
}
func
(
m
*
DposVrfRP
)
Reset
()
{
*
m
=
DposVrfRP
{}
}
func
(
m
*
DposVrfRP
)
Reset
()
{
*
m
=
DposVrfRP
{}
}
func
(
m
*
DposVrfRP
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVrfRP
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVrfRP
)
ProtoMessage
()
{}
func
(
*
DposVrfRP
)
ProtoMessage
()
{}
func
(
*
DposVrfRP
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
4
}
}
func
(
*
DposVrfRP
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
6
}
}
func
(
m
*
DposVrfRP
)
GetIndex
()
int64
{
func
(
m
*
DposVrfRP
)
GetIndex
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -1064,6 +1191,27 @@ func (m *DposVrfRP) GetTime() int64 {
...
@@ -1064,6 +1191,27 @@ func (m *DposVrfRP) GetTime() int64 {
return
0
return
0
}
}
func
(
m
*
DposVrfRP
)
GetCycleStart
()
int64
{
if
m
!=
nil
{
return
m
.
CycleStart
}
return
0
}
func
(
m
*
DposVrfRP
)
GetCycleMiddle
()
int64
{
if
m
!=
nil
{
return
m
.
CycleMiddle
}
return
0
}
func
(
m
*
DposVrfRP
)
GetCycleStop
()
int64
{
if
m
!=
nil
{
return
m
.
CycleStop
}
return
0
}
type
DposVrfMRegist
struct
{
type
DposVrfMRegist
struct
{
Pubkey
string
`protobuf:"bytes,1,opt,name=pubkey" json:"pubkey,omitempty"`
Pubkey
string
`protobuf:"bytes,1,opt,name=pubkey" json:"pubkey,omitempty"`
Cycle
int64
`protobuf:"varint,2,opt,name=cycle" json:"cycle,omitempty"`
Cycle
int64
`protobuf:"varint,2,opt,name=cycle" json:"cycle,omitempty"`
...
@@ -1073,7 +1221,7 @@ type DposVrfMRegist struct {
...
@@ -1073,7 +1221,7 @@ type DposVrfMRegist struct {
func
(
m
*
DposVrfMRegist
)
Reset
()
{
*
m
=
DposVrfMRegist
{}
}
func
(
m
*
DposVrfMRegist
)
Reset
()
{
*
m
=
DposVrfMRegist
{}
}
func
(
m
*
DposVrfMRegist
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVrfMRegist
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVrfMRegist
)
ProtoMessage
()
{}
func
(
*
DposVrfMRegist
)
ProtoMessage
()
{}
func
(
*
DposVrfMRegist
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
5
}
}
func
(
*
DposVrfMRegist
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
7
}
}
func
(
m
*
DposVrfMRegist
)
GetPubkey
()
string
{
func
(
m
*
DposVrfMRegist
)
GetPubkey
()
string
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -1106,7 +1254,7 @@ type DposVrfRPRegist struct {
...
@@ -1106,7 +1254,7 @@ type DposVrfRPRegist struct {
func
(
m
*
DposVrfRPRegist
)
Reset
()
{
*
m
=
DposVrfRPRegist
{}
}
func
(
m
*
DposVrfRPRegist
)
Reset
()
{
*
m
=
DposVrfRPRegist
{}
}
func
(
m
*
DposVrfRPRegist
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVrfRPRegist
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVrfRPRegist
)
ProtoMessage
()
{}
func
(
*
DposVrfRPRegist
)
ProtoMessage
()
{}
func
(
*
DposVrfRPRegist
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
6
}
}
func
(
*
DposVrfRPRegist
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
8
}
}
func
(
m
*
DposVrfRPRegist
)
GetPubkey
()
string
{
func
(
m
*
DposVrfRPRegist
)
GetPubkey
()
string
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -1138,21 +1286,24 @@ func (m *DposVrfRPRegist) GetP() string {
...
@@ -1138,21 +1286,24 @@ func (m *DposVrfRPRegist) GetP() string {
// ReceiptVrf vrf收据信息
// ReceiptVrf vrf收据信息
type
ReceiptVrf
struct
{
type
ReceiptVrf
struct
{
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Status
int64
`protobuf:"varint,3,opt,name=status" json:"status,omitempty"`
Status
int64
`protobuf:"varint,3,opt,name=status" json:"status,omitempty"`
Cycle
int64
`protobuf:"varint,4,opt,name=cycle" json:"cycle,omitempty"`
Cycle
int64
`protobuf:"varint,4,opt,name=cycle" json:"cycle,omitempty"`
Height
int64
`protobuf:"varint,5,opt,name=height" json:"height,omitempty"`
Height
int64
`protobuf:"varint,5,opt,name=height" json:"height,omitempty"`
M
[]
byte
`protobuf:"bytes,6,opt,name=m,proto3" json:"m,omitempty"`
M
[]
byte
`protobuf:"bytes,6,opt,name=m,proto3" json:"m,omitempty"`
R
[]
byte
`protobuf:"bytes,7,opt,name=r,proto3" json:"r,omitempty"`
R
[]
byte
`protobuf:"bytes,7,opt,name=r,proto3" json:"r,omitempty"`
P
[]
byte
`protobuf:"bytes,8,opt,name=p,proto3" json:"p,omitempty"`
P
[]
byte
`protobuf:"bytes,8,opt,name=p,proto3" json:"p,omitempty"`
Time
int64
`protobuf:"varint,9,opt,name=time" json:"time,omitempty"`
Time
int64
`protobuf:"varint,9,opt,name=time" json:"time,omitempty"`
CycleStart
int64
`protobuf:"varint,10,opt,name=cycleStart" json:"cycleStart,omitempty"`
CycleMiddle
int64
`protobuf:"varint,11,opt,name=cycleMiddle" json:"cycleMiddle,omitempty"`
CycleStop
int64
`protobuf:"varint,12,opt,name=cycleStop" json:"cycleStop,omitempty"`
}
}
func
(
m
*
ReceiptVrf
)
Reset
()
{
*
m
=
ReceiptVrf
{}
}
func
(
m
*
ReceiptVrf
)
Reset
()
{
*
m
=
ReceiptVrf
{}
}
func
(
m
*
ReceiptVrf
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
ReceiptVrf
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptVrf
)
ProtoMessage
()
{}
func
(
*
ReceiptVrf
)
ProtoMessage
()
{}
func
(
*
ReceiptVrf
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
7
}
}
func
(
*
ReceiptVrf
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
1
9
}
}
func
(
m
*
ReceiptVrf
)
GetIndex
()
int64
{
func
(
m
*
ReceiptVrf
)
GetIndex
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -1217,6 +1368,27 @@ func (m *ReceiptVrf) GetTime() int64 {
...
@@ -1217,6 +1368,27 @@ func (m *ReceiptVrf) GetTime() int64 {
return
0
return
0
}
}
func
(
m
*
ReceiptVrf
)
GetCycleStart
()
int64
{
if
m
!=
nil
{
return
m
.
CycleStart
}
return
0
}
func
(
m
*
ReceiptVrf
)
GetCycleMiddle
()
int64
{
if
m
!=
nil
{
return
m
.
CycleMiddle
}
return
0
}
func
(
m
*
ReceiptVrf
)
GetCycleStop
()
int64
{
if
m
!=
nil
{
return
m
.
CycleStop
}
return
0
}
type
VrfInfo
struct
{
type
VrfInfo
struct
{
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Pubkey
[]
byte
`protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
...
@@ -1231,7 +1403,7 @@ type VrfInfo struct {
...
@@ -1231,7 +1403,7 @@ type VrfInfo struct {
func
(
m
*
VrfInfo
)
Reset
()
{
*
m
=
VrfInfo
{}
}
func
(
m
*
VrfInfo
)
Reset
()
{
*
m
=
VrfInfo
{}
}
func
(
m
*
VrfInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
VrfInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
VrfInfo
)
ProtoMessage
()
{}
func
(
*
VrfInfo
)
ProtoMessage
()
{}
func
(
*
VrfInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
18
}
}
func
(
*
VrfInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
20
}
}
func
(
m
*
VrfInfo
)
GetIndex
()
int64
{
func
(
m
*
VrfInfo
)
GetIndex
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -1290,15 +1462,23 @@ func (m *VrfInfo) GetTime() int64 {
...
@@ -1290,15 +1462,23 @@ func (m *VrfInfo) GetTime() int64 {
}
}
type
DposVrfQuery
struct
{
type
DposVrfQuery
struct
{
Ty
int64
`protobuf:"varint,1,opt,name=ty" json:"ty,omitempty"`
Pubkeys
[]
string
`protobuf:"bytes,1,rep,name=pubkeys" json:"pubkeys,omitempty"`
Timestamp
int64
`protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"`
Ty
int64
`protobuf:"varint,2,opt,name=ty" json:"ty,omitempty"`
Cycle
int64
`protobuf:"varint,3,opt,name=cycle" json:"cycle,omitempty"`
Timestamp
int64
`protobuf:"varint,3,opt,name=timestamp" json:"timestamp,omitempty"`
Cycle
int64
`protobuf:"varint,4,opt,name=cycle" json:"cycle,omitempty"`
}
}
func
(
m
*
DposVrfQuery
)
Reset
()
{
*
m
=
DposVrfQuery
{}
}
func
(
m
*
DposVrfQuery
)
Reset
()
{
*
m
=
DposVrfQuery
{}
}
func
(
m
*
DposVrfQuery
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVrfQuery
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVrfQuery
)
ProtoMessage
()
{}
func
(
*
DposVrfQuery
)
ProtoMessage
()
{}
func
(
*
DposVrfQuery
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
19
}
}
func
(
*
DposVrfQuery
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
21
}
}
func
(
m
*
DposVrfQuery
)
GetPubkeys
()
[]
string
{
if
m
!=
nil
{
return
m
.
Pubkeys
}
return
nil
}
func
(
m
*
DposVrfQuery
)
GetTy
()
int64
{
func
(
m
*
DposVrfQuery
)
GetTy
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -1321,16 +1501,88 @@ func (m *DposVrfQuery) GetCycle() int64 {
...
@@ -1321,16 +1501,88 @@ func (m *DposVrfQuery) GetCycle() int64 {
return
0
return
0
}
}
type
JsonVrfInfo
struct
{
Index
int64
`protobuf:"varint,1,opt,name=Index" json:"Index,omitempty"`
Pubkey
string
`protobuf:"bytes,2,opt,name=pubkey" json:"pubkey,omitempty"`
Cycle
int64
`protobuf:"varint,4,opt,name=cycle" json:"cycle,omitempty"`
Height
int64
`protobuf:"varint,5,opt,name=height" json:"height,omitempty"`
M
string
`protobuf:"bytes,6,opt,name=m" json:"m,omitempty"`
R
string
`protobuf:"bytes,7,opt,name=r" json:"r,omitempty"`
P
string
`protobuf:"bytes,8,opt,name=p" json:"p,omitempty"`
Time
int64
`protobuf:"varint,9,opt,name=time" json:"time,omitempty"`
}
func
(
m
*
JsonVrfInfo
)
Reset
()
{
*
m
=
JsonVrfInfo
{}
}
func
(
m
*
JsonVrfInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
JsonVrfInfo
)
ProtoMessage
()
{}
func
(
*
JsonVrfInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
22
}
}
func
(
m
*
JsonVrfInfo
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
func
(
m
*
JsonVrfInfo
)
GetPubkey
()
string
{
if
m
!=
nil
{
return
m
.
Pubkey
}
return
""
}
func
(
m
*
JsonVrfInfo
)
GetCycle
()
int64
{
if
m
!=
nil
{
return
m
.
Cycle
}
return
0
}
func
(
m
*
JsonVrfInfo
)
GetHeight
()
int64
{
if
m
!=
nil
{
return
m
.
Height
}
return
0
}
func
(
m
*
JsonVrfInfo
)
GetM
()
string
{
if
m
!=
nil
{
return
m
.
M
}
return
""
}
func
(
m
*
JsonVrfInfo
)
GetR
()
string
{
if
m
!=
nil
{
return
m
.
R
}
return
""
}
func
(
m
*
JsonVrfInfo
)
GetP
()
string
{
if
m
!=
nil
{
return
m
.
P
}
return
""
}
func
(
m
*
JsonVrfInfo
)
GetTime
()
int64
{
if
m
!=
nil
{
return
m
.
Time
}
return
0
}
type
DposVrfReply
struct
{
type
DposVrfReply
struct
{
Vrf
[]
*
VrfInfo
`protobuf:"bytes,1,rep,name=vrf" json:"vrf,omitempty"`
Vrf
[]
*
Json
VrfInfo
`protobuf:"bytes,1,rep,name=vrf" json:"vrf,omitempty"`
}
}
func
(
m
*
DposVrfReply
)
Reset
()
{
*
m
=
DposVrfReply
{}
}
func
(
m
*
DposVrfReply
)
Reset
()
{
*
m
=
DposVrfReply
{}
}
func
(
m
*
DposVrfReply
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
DposVrfReply
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
DposVrfReply
)
ProtoMessage
()
{}
func
(
*
DposVrfReply
)
ProtoMessage
()
{}
func
(
*
DposVrfReply
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
2
0
}
}
func
(
*
DposVrfReply
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
2
3
}
}
func
(
m
*
DposVrfReply
)
GetVrf
()
[]
*
VrfInfo
{
func
(
m
*
DposVrfReply
)
GetVrf
()
[]
*
Json
VrfInfo
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Vrf
return
m
.
Vrf
}
}
...
@@ -1347,8 +1599,10 @@ func init() {
...
@@ -1347,8 +1599,10 @@ func init() {
proto
.
RegisterType
((
*
DposCancelVote
)(
nil
),
"types.DposCancelVote"
)
proto
.
RegisterType
((
*
DposCancelVote
)(
nil
),
"types.DposCancelVote"
)
proto
.
RegisterType
((
*
DposVoteAction
)(
nil
),
"types.DposVoteAction"
)
proto
.
RegisterType
((
*
DposVoteAction
)(
nil
),
"types.DposVoteAction"
)
proto
.
RegisterType
((
*
CandidatorQuery
)(
nil
),
"types.CandidatorQuery"
)
proto
.
RegisterType
((
*
CandidatorQuery
)(
nil
),
"types.CandidatorQuery"
)
proto
.
RegisterType
((
*
JsonCandidator
)(
nil
),
"types.JsonCandidator"
)
proto
.
RegisterType
((
*
CandidatorReply
)(
nil
),
"types.CandidatorReply"
)
proto
.
RegisterType
((
*
CandidatorReply
)(
nil
),
"types.CandidatorReply"
)
proto
.
RegisterType
((
*
DposVoteQuery
)(
nil
),
"types.DposVoteQuery"
)
proto
.
RegisterType
((
*
DposVoteQuery
)(
nil
),
"types.DposVoteQuery"
)
proto
.
RegisterType
((
*
JsonDposVoter
)(
nil
),
"types.JsonDposVoter"
)
proto
.
RegisterType
((
*
DposVoteReply
)(
nil
),
"types.DposVoteReply"
)
proto
.
RegisterType
((
*
DposVoteReply
)(
nil
),
"types.DposVoteReply"
)
proto
.
RegisterType
((
*
ReceiptCandicator
)(
nil
),
"types.ReceiptCandicator"
)
proto
.
RegisterType
((
*
ReceiptCandicator
)(
nil
),
"types.ReceiptCandicator"
)
proto
.
RegisterType
((
*
DposVrfM
)(
nil
),
"types.DposVrfM"
)
proto
.
RegisterType
((
*
DposVrfM
)(
nil
),
"types.DposVrfM"
)
...
@@ -1358,73 +1612,82 @@ func init() {
...
@@ -1358,73 +1612,82 @@ func init() {
proto
.
RegisterType
((
*
ReceiptVrf
)(
nil
),
"types.ReceiptVrf"
)
proto
.
RegisterType
((
*
ReceiptVrf
)(
nil
),
"types.ReceiptVrf"
)
proto
.
RegisterType
((
*
VrfInfo
)(
nil
),
"types.VrfInfo"
)
proto
.
RegisterType
((
*
VrfInfo
)(
nil
),
"types.VrfInfo"
)
proto
.
RegisterType
((
*
DposVrfQuery
)(
nil
),
"types.DposVrfQuery"
)
proto
.
RegisterType
((
*
DposVrfQuery
)(
nil
),
"types.DposVrfQuery"
)
proto
.
RegisterType
((
*
JsonVrfInfo
)(
nil
),
"types.JsonVrfInfo"
)
proto
.
RegisterType
((
*
DposVrfReply
)(
nil
),
"types.DposVrfReply"
)
proto
.
RegisterType
((
*
DposVrfReply
)(
nil
),
"types.DposVrfReply"
)
}
}
func
init
()
{
proto
.
RegisterFile
(
"dposvote.proto"
,
fileDescriptor0
)
}
func
init
()
{
proto
.
RegisterFile
(
"dposvote.proto"
,
fileDescriptor0
)
}
var
fileDescriptor0
=
[]
byte
{
var
fileDescriptor0
=
[]
byte
{
// 992 bytes of a gzipped FileDescriptorProto
// 1117 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xbc
,
0x57
,
0xdd
,
0x8e
,
0xdb
,
0x44
,
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xbc
,
0x57
,
0x51
,
0x8f
,
0xdb
,
0xc4
,
0x14
,
0x8e
,
0xed
,
0x38
,
0xb1
,
0x8f
,
0xdd
,
0x2c
,
0x1d
,
0xd2
,
0xca
,
0x2a
,
0x08
,
0x05
,
0x4b
,
0xa0
,
0x13
,
0x8f
,
0xed
,
0x38
,
0x89
,
0xc7
,
0xbe
,
0xdc
,
0xff
,
0xbf
,
0xa4
,
0x95
,
0x55
,
0x10
,
0x0a
,
0x56
,
0x5c
,
0xad
,
0x68
,
0x0a
,
0xaa
,
0x40
,
0x02
,
0xa9
,
0x5d
,
0x04
,
0xa9
,
0x04
,
0xa5
,
0x0c
,
0xab
,
0x15
,
0x91
,
0x22
,
0x1e
,
0x4e
,
0x6a
,
0x28
,
0x42
,
0x80
,
0x40
,
0x6a
,
0x0f
,
0x89
,
0xb4
,
0xa2
,
0xa5
,
0x6c
,
0x12
,
0x57
,
0xae
,
0x3d
,
0xd9
,
0xb5
,
0x48
,
0x62
,
0x6b
,
0xec
,
0x5d
,
0x35
,
0x12
,
0x12
,
0xb7
,
0xbc
,
0x4f
,
0x27
,
0x24
,
0x9e
,
0x5c
,
0x7b
,
0x73
,
0x67
,
0x91
,
0xc4
,
0xd6
,
0xda
,
0x77
,
0x6a
,
0x24
,
0x24
,
0x07
,
0xe2
,
0x35
,
0xb8
,
0xe2
,
0x59
,
0x78
,
0x0a
,
0x2e
,
0xd0
,
0x9c
,
0x19
,
0x8f
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d
,
0xe8
,
0x1f
,
0xf3
,
0x39
,
0x3e
,
0xef
,
0x1b
,
0xde
,
0xe8
,
0x57
,
0x8f
,
0x42
,
0xb4
,
0x80
,
0xc0
,
0x5c
,
0x0c
,
0xae
,
0x18
,
0x61
,
0x72
,
0x98
,
0xcb
,
0xfb
,
0x61
,
0x57
,
0x6b
,
0x51
,
0xbd
,
0x88
,
0x50
,
0x56
,
0xf1
,
0xb2
,
0x50
,
0x34
,
0xd6
,
0x8a
,
0xcb
,
0x6b
,
0x88
,
0x7e
,
0xb3
,
0xc0
,
0x17
,
0x83
,
0x64
,
0x17
,
0x5c
,
0xbc
,
0x7f
,
0x8b
,
0x8b
,
0xd7
,
0xc0
,
0xc5
,
0x6b
,
0xe0
,
0xe2
,
0x6d
,
0xc3
,
0xe5
,
0xbe
,
0xc6
,
0x45
,
0x4e
,
0xc5
,
0xbb
,
0xe0
,
0x9c
,
0xf3
,
0xb9
,
0x9a
,
0x89
,
0xc4
,
0x98
,
0x89
,
0xaa
,
0x14
,
0x2a
,
0xcc
,
0x2f
,
0x7a
,
0xf8
,
0x37
,
0xfb
,
0xfd
,
0xbf
,
0x03
,
0x00
,
0x00
,
0xff
,
0xff
,
0xcb
,
0x64
,
0xcc
,
0x30
,
0x78
,
0x0f
,
0x00
,
0x00
,
}
}
plugin/dapp/dposvote/types/errors.go
View file @
1c6d4f4b
...
@@ -8,6 +8,7 @@ import "errors"
...
@@ -8,6 +8,7 @@ import "errors"
// Errors for Dpos
// Errors for Dpos
var
(
var
(
ErrNoSuchVote
=
errors
.
New
(
"ErrNoSuchVote"
)
ErrNotEnoughVotes
=
errors
.
New
(
"ErrNotEnoughVotes"
)
ErrNotEnoughVotes
=
errors
.
New
(
"ErrNotEnoughVotes"
)
ErrCandidatorExist
=
errors
.
New
(
"ErrCandidatorExist"
)
ErrCandidatorExist
=
errors
.
New
(
"ErrCandidatorExist"
)
ErrCandidatorInvalidStatus
=
errors
.
New
(
"ErrCandidatorInvalidStatus"
)
ErrCandidatorInvalidStatus
=
errors
.
New
(
"ErrCandidatorInvalidStatus"
)
...
...
plugin/dapp/dposvote/types/table.go
View file @
1c6d4f4b
...
@@ -126,7 +126,7 @@ var opt_dpos_vrfm = &table.Option{
...
@@ -126,7 +126,7 @@ var opt_dpos_vrfm = &table.Option{
Prefix
:
"LODB-dpos"
,
Prefix
:
"LODB-dpos"
,
Name
:
"vrfm"
,
Name
:
"vrfm"
,
Primary
:
"index"
,
Primary
:
"index"
,
Index
:
[]
string
{
"pubkey_cycle"
},
Index
:
[]
string
{
"pubkey_cycle"
,
"cycle"
},
}
}
//NewDposVrfMTable 新建表
//NewDposVrfMTable 新建表
...
@@ -169,6 +169,8 @@ func (tx *DposVrfMRow) Get(key string) ([]byte, error) {
...
@@ -169,6 +169,8 @@ func (tx *DposVrfMRow) Get(key string) ([]byte, error) {
return
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
tx
.
Index
)),
nil
return
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
tx
.
Index
)),
nil
}
else
if
key
==
"pubkey_cycle"
{
}
else
if
key
==
"pubkey_cycle"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
tx
.
Pubkey
,
tx
.
Cycle
)),
nil
return
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
tx
.
Pubkey
,
tx
.
Cycle
)),
nil
}
else
if
key
==
"cycle"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
tx
.
Cycle
)),
nil
}
}
return
nil
,
types
.
ErrNotFound
return
nil
,
types
.
ErrNotFound
...
@@ -179,7 +181,7 @@ var opt_dpos_vrfrp = &table.Option{
...
@@ -179,7 +181,7 @@ var opt_dpos_vrfrp = &table.Option{
Prefix
:
"LODB-dpos"
,
Prefix
:
"LODB-dpos"
,
Name
:
"vrfrp"
,
Name
:
"vrfrp"
,
Primary
:
"index"
,
Primary
:
"index"
,
Index
:
[]
string
{
"pubkey_cycle"
},
Index
:
[]
string
{
"pubkey_cycle"
,
"cycle"
},
}
}
//NewDposVrfRPTable 新建表
//NewDposVrfRPTable 新建表
...
@@ -222,6 +224,8 @@ func (tx *DposVrfRPRow) Get(key string) ([]byte, error) {
...
@@ -222,6 +224,8 @@ func (tx *DposVrfRPRow) Get(key string) ([]byte, error) {
return
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
tx
.
Index
)),
nil
return
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
tx
.
Index
)),
nil
}
else
if
key
==
"pubkey_cycle"
{
}
else
if
key
==
"pubkey_cycle"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
tx
.
Pubkey
,
tx
.
Cycle
)),
nil
return
[]
byte
(
fmt
.
Sprintf
(
"%X:%018d"
,
tx
.
Pubkey
,
tx
.
Cycle
)),
nil
}
else
if
key
==
"cycle"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%018d"
,
tx
.
Cycle
)),
nil
}
}
return
nil
,
types
.
ErrNotFound
return
nil
,
types
.
ErrNotFound
...
...
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