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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
237 additions
and
89 deletions
+237
-89
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
+0
-0
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
+0
-0
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
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
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