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
12a5d47e
Commit
12a5d47e
authored
Jan 23, 2019
by
kingwang
Committed by
33cn
Jan 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixbug #253
parent
c5730591
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
15 deletions
+16
-15
ticket.go
plugin/dapp/ticket/commands/ticket.go
+2
-8
jrpc_channel_test.go
plugin/dapp/ticket/rpc/jrpc_channel_test.go
+4
-4
rpc.go
plugin/dapp/ticket/rpc/rpc.go
+1
-3
rpc_real_test.go
plugin/dapp/ticket/rpc/rpc_real_test.go
+9
-0
No files found.
plugin/dapp/ticket/commands/ticket.go
View file @
12a5d47e
...
...
@@ -10,7 +10,6 @@ import (
"fmt"
"os"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
...
...
@@ -130,7 +129,7 @@ func closeTicket(cmd *cobra.Command, args []string) {
MinerAddress
:
bindAddr
,
}
var
res
types
.
ReplyHashes
var
res
rpc
types
.
ReplyHashes
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
...
...
@@ -146,12 +145,7 @@ func closeTicket(cmd *cobra.Command, args []string) {
return
}
var
tx
txHashes
for
_
,
hash
:=
range
res
.
Hashes
{
tx
.
Hashes
=
append
(
tx
.
Hashes
,
common
.
ToHex
(
hash
))
}
data
,
err
:=
json
.
MarshalIndent
(
tx
,
""
,
" "
)
data
,
err
:=
json
.
MarshalIndent
(
res
,
""
,
" "
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
...
...
plugin/dapp/ticket/rpc/jrpc_channel_test.go
View file @
12a5d47e
...
...
@@ -46,13 +46,13 @@ func TestJRPCChannel(t *testing.T) {
}
func
testCountTicketCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
res
types
.
ReplyHashes
return
jrpc
.
Call
(
"ticket.
CloseTickets
"
,
nil
,
&
res
)
var
res
int64
return
jrpc
.
Call
(
"ticket.
GetTicketCount
"
,
nil
,
&
res
)
}
func
testCloseTicketCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
res
int64
return
jrpc
.
Call
(
"ticket.
GetTicketCount
"
,
nil
,
&
res
)
var
res
types
.
ReplyHashes
return
jrpc
.
Call
(
"ticket.
CloseTickets
"
,
nil
,
&
res
)
}
func
testGetColdAddrByMinerCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
...
...
plugin/dapp/ticket/rpc/rpc.go
View file @
12a5d47e
...
...
@@ -5,8 +5,6 @@
package
rpc
import
(
"encoding/hex"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
rpctypes
"github.com/33cn/chain33/rpc/types"
...
...
@@ -115,7 +113,7 @@ func (c *Jrpc) CloseTickets(in *ty.TicketClose, result *interface{}) error {
}
var
hashes
rpctypes
.
ReplyHashes
for
_
,
has
:=
range
resp
.
Hashes
{
hashes
.
Hashes
=
append
(
hashes
.
Hashes
,
hex
.
EncodeToString
(
has
))
hashes
.
Hashes
=
append
(
hashes
.
Hashes
,
common
.
ToHex
(
has
))
}
*
result
=
&
hashes
return
nil
...
...
plugin/dapp/ticket/rpc/rpc_real_test.go
View file @
12a5d47e
...
...
@@ -8,9 +8,12 @@ package rpc_test
import
(
"testing"
rpctypes
"github.com/33cn/chain33/rpc/types"
_
"github.com/33cn/chain33/system"
"github.com/33cn/chain33/util/testnode"
_
"github.com/33cn/plugin/plugin"
ty
"github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/stretchr/testify/assert"
)
func
TestNewTicket
(
t
*
testing
.
T
)
{
...
...
@@ -19,4 +22,10 @@ func TestNewTicket(t *testing.T) {
mock33
:=
testnode
.
NewWithConfig
(
cfg
,
sub
,
nil
)
defer
mock33
.
Close
()
mock33
.
WaitHeight
(
5
)
mock33
.
Listen
()
//选票(可以用hotwallet 关闭选票)
in
:=
&
ty
.
TicketClose
{
MinerAddress
:
mock33
.
GetHotAddress
()}
var
res
rpctypes
.
ReplyHashes
err
:=
mock33
.
GetJSONC
()
.
Call
(
"ticket.CloseTickets"
,
in
,
&
res
)
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