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
21652d43
Commit
21652d43
authored
Sep 08, 2019
by
liuyuhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify ticket test
parent
64412efb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
21 deletions
+20
-21
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-2
proposal_change.go
plugin/dapp/autonomy/commands/proposal_change.go
+1
-1
proposal_rule.go
plugin/dapp/autonomy/commands/proposal_rule.go
+2
-2
ticketdb.go
plugin/dapp/ticket/executor/ticketdb.go
+2
-2
jrpc_channel_test.go
plugin/dapp/ticket/rpc/jrpc_channel_test.go
+10
-4
rpc_real_test.go
plugin/dapp/ticket/rpc/rpc_real_test.go
+2
-9
No files found.
go.mod
View file @
21652d43
...
@@ -3,7 +3,7 @@ module github.com/33cn/plugin
...
@@ -3,7 +3,7 @@ module github.com/33cn/plugin
go 1.12
go 1.12
require (
require (
github.com/33cn/chain33 v0.0.0-2019090
3065145-c663001cb18e
github.com/33cn/chain33 v0.0.0-2019090
6093700-93b043f5fce6
github.com/BurntSushi/toml v0.3.1
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/Sia v1.3.7
github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac
github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac
...
...
go.sum
View file @
21652d43
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/33cn/chain33 v0.0.0-2019090
3065145-c663001cb18e h1:n/QEXOOLoD7rnnub5eHzUKIG5e2dzbhVJoxpcu5e5ko
=
github.com/33cn/chain33 v0.0.0-2019090
6093700-93b043f5fce6 h1:zj6rCGS9sowochmjveOoxhunvhqpkx1S6abhhhfS7KU
=
github.com/33cn/chain33 v0.0.0-2019090
3065145-c663001cb18e
/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
github.com/33cn/chain33 v0.0.0-2019090
6093700-93b043f5fce6
/go.mod h1:4I8n+Zyf3t0UKM5jjpqJY627Tub62oXkLsdzIv4r6rQ=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 h1:PqzgE6kAMi81xWQA2QIVxjWkFHptGgC547vchpUbtFo=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 h1:PqzgE6kAMi81xWQA2QIVxjWkFHptGgC547vchpUbtFo=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
...
...
plugin/dapp/autonomy/commands/proposal_change.go
View file @
21652d43
...
@@ -238,7 +238,7 @@ func addShowProposalChangeflags(cmd *cobra.Command) {
...
@@ -238,7 +238,7 @@ func addShowProposalChangeflags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Uint32P
(
"status"
,
"s"
,
0
,
"status"
)
cmd
.
Flags
()
.
Uint32P
(
"status"
,
"s"
,
0
,
"status"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"address"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"address"
)
cmd
.
Flags
()
.
Int32P
(
"count"
,
"c"
,
1
,
"count, default is 1"
)
cmd
.
Flags
()
.
Int32P
(
"count"
,
"c"
,
1
,
"count, default is 1"
)
cmd
.
Flags
()
.
Int32P
(
"direction"
,
"d"
,
-
1
,
"direction, default is reserve"
)
cmd
.
Flags
()
.
Int32P
(
"direction"
,
"d"
,
0
,
"direction, default is reserve"
)
cmd
.
Flags
()
.
Int64P
(
"height"
,
"t"
,
-
1
,
"height, default is -1"
)
cmd
.
Flags
()
.
Int64P
(
"height"
,
"t"
,
-
1
,
"height, default is -1"
)
cmd
.
Flags
()
.
Int32P
(
"index"
,
"i"
,
-
1
,
"index, default is -1"
)
cmd
.
Flags
()
.
Int32P
(
"index"
,
"i"
,
-
1
,
"index, default is -1"
)
}
}
...
...
plugin/dapp/autonomy/commands/proposal_rule.go
View file @
21652d43
...
@@ -237,7 +237,7 @@ func addShowProposalRuleflags(cmd *cobra.Command) {
...
@@ -237,7 +237,7 @@ func addShowProposalRuleflags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Uint32P
(
"status"
,
"s"
,
0
,
"status"
)
cmd
.
Flags
()
.
Uint32P
(
"status"
,
"s"
,
0
,
"status"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"address"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"address"
)
cmd
.
Flags
()
.
Int32P
(
"count"
,
"c"
,
1
,
"count, default is 1"
)
cmd
.
Flags
()
.
Int32P
(
"count"
,
"c"
,
1
,
"count, default is 1"
)
cmd
.
Flags
()
.
Int32P
(
"direction"
,
"d"
,
-
1
,
"direction, default is reserve"
)
cmd
.
Flags
()
.
Int32P
(
"direction"
,
"d"
,
0
,
"direction, default is reserve"
)
cmd
.
Flags
()
.
Int64P
(
"height"
,
"t"
,
-
1
,
"height, default is -1"
)
cmd
.
Flags
()
.
Int64P
(
"height"
,
"t"
,
-
1
,
"height, default is -1"
)
cmd
.
Flags
()
.
Int32P
(
"index"
,
"i"
,
-
1
,
"index, default is -1"
)
cmd
.
Flags
()
.
Int32P
(
"index"
,
"i"
,
-
1
,
"index, default is -1"
)
}
}
...
@@ -402,7 +402,7 @@ func addShowProposalCommentflags(cmd *cobra.Command) {
...
@@ -402,7 +402,7 @@ func addShowProposalCommentflags(cmd *cobra.Command) {
cmd
.
Flags
()
.
StringP
(
"proposalID"
,
"p"
,
""
,
"proposal ID"
)
cmd
.
Flags
()
.
StringP
(
"proposalID"
,
"p"
,
""
,
"proposal ID"
)
cmd
.
MarkFlagRequired
(
"proposalID"
)
cmd
.
MarkFlagRequired
(
"proposalID"
)
cmd
.
Flags
()
.
Int32P
(
"count"
,
"c"
,
1
,
"count, default is 1"
)
cmd
.
Flags
()
.
Int32P
(
"count"
,
"c"
,
1
,
"count, default is 1"
)
cmd
.
Flags
()
.
Int32P
(
"direction"
,
"d"
,
-
1
,
"direction, default is reserve"
)
cmd
.
Flags
()
.
Int32P
(
"direction"
,
"d"
,
0
,
"direction, default is reserve"
)
cmd
.
Flags
()
.
Int64P
(
"height"
,
"t"
,
-
1
,
"height, default is -1"
)
cmd
.
Flags
()
.
Int64P
(
"height"
,
"t"
,
-
1
,
"height, default is -1"
)
cmd
.
Flags
()
.
Int64P
(
"index"
,
"i"
,
-
1
,
"index, default is -1"
)
cmd
.
Flags
()
.
Int64P
(
"index"
,
"i"
,
-
1
,
"index, default is -1"
)
}
}
...
...
plugin/dapp/ticket/executor/ticketdb.go
View file @
21652d43
...
@@ -346,13 +346,13 @@ func (action *Action) TicketMiner(miner *ty.TicketMiner, index int) (*types.Rece
...
@@ -346,13 +346,13 @@ func (action *Action) TicketMiner(miner *ty.TicketMiner, index int) (*types.Rece
addr
:=
types
.
MGStr
(
"mver.consensus.fundKeyAddr"
,
action
.
height
)
addr
:=
types
.
MGStr
(
"mver.consensus.fundKeyAddr"
,
action
.
height
)
receipt2
,
err
=
action
.
coinsAccount
.
ExecIssueCoins
(
addr
,
cfg
.
CoinDevFund
)
receipt2
,
err
=
action
.
coinsAccount
.
ExecIssueCoins
(
addr
,
cfg
.
CoinDevFund
)
if
err
!=
nil
{
if
err
!=
nil
{
tlog
.
Error
(
"TicketMiner.ExecDepositFrozen fund to autonomy fund"
,
"addr"
,
addr
)
tlog
.
Error
(
"TicketMiner.ExecDepositFrozen fund to autonomy fund"
,
"addr"
,
addr
,
"error"
,
err
)
return
nil
,
err
return
nil
,
err
}
}
}
else
{
}
else
{
receipt2
,
err
=
action
.
coinsAccount
.
ExecDepositFrozen
(
types
.
GetFundAddr
(),
action
.
execaddr
,
cfg
.
CoinDevFund
)
receipt2
,
err
=
action
.
coinsAccount
.
ExecDepositFrozen
(
types
.
GetFundAddr
(),
action
.
execaddr
,
cfg
.
CoinDevFund
)
if
err
!=
nil
{
if
err
!=
nil
{
tlog
.
Error
(
"TicketMiner.ExecDepositFrozen fund"
,
"addr"
,
types
.
GetFundAddr
(),
"execaddr"
,
action
.
execaddr
)
tlog
.
Error
(
"TicketMiner.ExecDepositFrozen fund"
,
"addr"
,
types
.
GetFundAddr
(),
"execaddr"
,
action
.
execaddr
,
"error"
,
err
)
return
nil
,
err
return
nil
,
err
}
}
}
}
...
...
plugin/dapp/ticket/rpc/jrpc_channel_test.go
View file @
21652d43
...
@@ -17,12 +17,18 @@ import (
...
@@ -17,12 +17,18 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/assert"
)
)
func
TestJRPCChannel
(
t
*
testing
.
T
)
{
var
mocker
*
testnode
.
Chain33Mock
// 启动RPCmocker
mocker
:=
testnode
.
New
(
"--notset--"
,
nil
)
func
TestMain
(
m
*
testing
.
M
)
{
defer
mocker
.
Close
()
cfg
,
sub
:=
testnode
.
GetDefaultConfig
()
cfg
.
Consensus
.
Name
=
"ticket"
mocker
=
testnode
.
NewWithConfig
(
cfg
,
sub
,
nil
)
mocker
.
Listen
()
mocker
.
Listen
()
m
.
Run
()
mocker
.
Close
()
}
func
TestJRPCChannel
(
t
*
testing
.
T
)
{
jrpcClient
:=
mocker
.
GetJSONC
()
jrpcClient
:=
mocker
.
GetJSONC
()
testCases
:=
[]
struct
{
testCases
:=
[]
struct
{
...
...
plugin/dapp/ticket/rpc/rpc_real_test.go
View file @
21652d43
...
@@ -10,22 +10,15 @@ import (
...
@@ -10,22 +10,15 @@ import (
rpctypes
"github.com/33cn/chain33/rpc/types"
rpctypes
"github.com/33cn/chain33/rpc/types"
_
"github.com/33cn/chain33/system"
_
"github.com/33cn/chain33/system"
"github.com/33cn/chain33/util/testnode"
_
"github.com/33cn/plugin/plugin"
_
"github.com/33cn/plugin/plugin"
ty
"github.com/33cn/plugin/plugin/dapp/ticket/types"
ty
"github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/assert"
)
)
func
TestNewTicket
(
t
*
testing
.
T
)
{
func
TestNewTicket
(
t
*
testing
.
T
)
{
cfg
,
sub
:=
testnode
.
GetDefaultConfig
()
cfg
.
Consensus
.
Name
=
"ticket"
mock33
:=
testnode
.
NewWithConfig
(
cfg
,
sub
,
nil
)
defer
mock33
.
Close
()
mock33
.
WaitHeight
(
5
)
mock33
.
Listen
()
//选票(可以用hotwallet 关闭选票)
//选票(可以用hotwallet 关闭选票)
in
:=
&
ty
.
TicketClose
{
MinerAddress
:
mock
33
.
GetHotAddress
()}
in
:=
&
ty
.
TicketClose
{
MinerAddress
:
mock
er
.
GetHotAddress
()}
var
res
rpctypes
.
ReplyHashes
var
res
rpctypes
.
ReplyHashes
err
:=
mock
33
.
GetJSONC
()
.
Call
(
"ticket.CloseTickets"
,
in
,
&
res
)
err
:=
mock
er
.
GetJSONC
()
.
Call
(
"ticket.CloseTickets"
,
in
,
&
res
)
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
}
}
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