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
1d8ddb8c
Commit
1d8ddb8c
authored
Dec 26, 2018
by
harrylee2015
Committed by
vipwzw
Jan 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rejust para rpc query
parent
6811bb28
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
24 deletions
+43
-24
paracross.go
plugin/dapp/paracross/commands/paracross.go
+19
-0
rpc.go
plugin/dapp/paracross/rpc/rpc.go
+23
-0
queueprotocol.go
vendor/github.com/33cn/chain33/client/queueprotocol.go
+1
-7
base.go
vendor/github.com/33cn/chain33/system/consensus/base.go
+0
-17
No files found.
plugin/dapp/paracross/commands/paracross.go
View file @
1d8ddb8c
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"os"
"os"
"strings"
"strings"
"github.com/33cn/chain33/rpc/jsonclient"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
...
@@ -29,6 +30,7 @@ func ParcCmd() *cobra.Command {
...
@@ -29,6 +30,7 @@ func ParcCmd() *cobra.Command {
CreateRawTransferCmd
(),
CreateRawTransferCmd
(),
CreateRawWithdrawCmd
(),
CreateRawWithdrawCmd
(),
CreateRawTransferToExecCmd
(),
CreateRawTransferToExecCmd
(),
IsSyncCmd
(),
)
)
return
cmd
return
cmd
}
}
...
@@ -281,3 +283,20 @@ func createTransferTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
...
@@ -281,3 +283,20 @@ func createTransferTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
txHex
:=
types
.
Encode
(
tx
)
txHex
:=
types
.
Encode
(
tx
)
return
hex
.
EncodeToString
(
txHex
),
nil
return
hex
.
EncodeToString
(
txHex
),
nil
}
}
// IsSyncCmd query parachain is sync
func
IsSyncCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"is_sync"
,
Short
:
"query parachain is sync"
,
Run
:
isSync
,
}
return
cmd
}
func
isSync
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
var
res
bool
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.IsSync"
,
nil
,
&
res
)
ctx
.
Run
()
}
plugin/dapp/paracross/rpc/rpc.go
View file @
1d8ddb8c
...
@@ -91,3 +91,26 @@ func (c *Jrpc) GetAssetTxResult(req *types.ReqHash, result *interface{}) error {
...
@@ -91,3 +91,26 @@ func (c *Jrpc) GetAssetTxResult(req *types.ReqHash, result *interface{}) error {
*
result
=
data
*
result
=
data
return
err
return
err
}
}
// IsSync query is sync
func
(
g
*
channelClient
)
IsSync
(
ctx
context
.
Context
,
in
*
types
.
ReqNil
)
(
*
types
.
IsCaughtUp
,
error
)
{
data
,
err
:=
g
.
QueryConsensusFunc
(
"para"
,
"IsCaughtUp"
,
&
types
.
ReqNil
{})
if
err
!=
nil
{
return
nil
,
err
}
return
data
.
(
*
types
.
IsCaughtUp
),
nil
}
// IsSync query is sync
func
(
c
*
Jrpc
)
IsSync
(
in
*
types
.
ReqNil
,
result
*
bool
)
error
{
//TODO consensus and paracross are not the same registered names ?
data
,
err
:=
c
.
cli
.
QueryConsensusFunc
(
"para"
,
"IsCaughtUp"
,
&
types
.
ReqNil
{})
*
result
=
false
if
err
!=
nil
{
return
err
}
if
reply
,
ok
:=
data
.
(
*
types
.
IsCaughtUp
);
ok
{
*
result
=
reply
.
Iscaughtup
}
return
nil
}
vendor/github.com/33cn/chain33/client/queueprotocol.go
View file @
1d8ddb8c
...
@@ -678,13 +678,7 @@ func (q *QueueProtocol) DumpPrivkey(param *types.ReqString) (*types.ReplyString,
...
@@ -678,13 +678,7 @@ func (q *QueueProtocol) DumpPrivkey(param *types.ReqString) (*types.ReplyString,
// IsSync query the blockchain sync state
// IsSync query the blockchain sync state
func
(
q
*
QueueProtocol
)
IsSync
()
(
*
types
.
Reply
,
error
)
{
func
(
q
*
QueueProtocol
)
IsSync
()
(
*
types
.
Reply
,
error
)
{
var
msg
queue
.
Message
msg
,
err
:=
q
.
query
(
blockchainKey
,
types
.
EventIsSync
,
&
types
.
ReqNil
{})
var
err
error
if
types
.
IsPara
()
{
msg
,
err
=
q
.
query
(
consensusKey
,
types
.
EventIsSync
,
&
types
.
ReqNil
{})
}
else
{
msg
,
err
=
q
.
query
(
blockchainKey
,
types
.
EventIsSync
,
&
types
.
ReqNil
{})
}
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"IsSync"
,
"Error"
,
err
.
Error
())
log
.
Error
(
"IsSync"
,
"Error"
,
err
.
Error
())
return
nil
,
err
return
nil
,
err
...
...
vendor/github.com/33cn/chain33/system/consensus/base.go
View file @
1d8ddb8c
...
@@ -216,23 +216,6 @@ func (bc *BaseClient) EventLoop() {
...
@@ -216,23 +216,6 @@ func (bc *BaseClient) EventLoop() {
block
:=
msg
.
GetData
()
.
(
*
types
.
BlockDetail
)
block
:=
msg
.
GetData
()
.
(
*
types
.
BlockDetail
)
err
:=
bc
.
CheckBlock
(
block
)
err
:=
bc
.
CheckBlock
(
block
)
msg
.
ReplyErr
(
"EventCheckBlock"
,
err
)
msg
.
ReplyErr
(
"EventCheckBlock"
,
err
)
}
else
if
msg
.
Ty
==
types
.
EventIsSync
{
if
types
.
IsPara
()
{
reply
,
err
:=
QueryData
.
Call
(
"para"
,
"IsCaughtUp"
,
&
types
.
ReqNil
{})
if
err
!=
nil
{
msg
.
Reply
(
bc
.
api
.
NewMessage
(
""
,
types
.
EventReplyIsSync
,
err
))
}
else
{
if
isCaughtUp
,
ok
:=
reply
.
(
*
types
.
IsCaughtUp
);
ok
{
msg
.
Reply
(
bc
.
api
.
NewMessage
(
""
,
types
.
EventReplyIsSync
,
isCaughtUp
))
}
else
{
err
=
types
.
ErrTypeAsset
msg
.
Reply
(
bc
.
api
.
NewMessage
(
""
,
types
.
EventReplyIsSync
,
err
))
}
}
}
else
{
msg
.
Reply
(
bc
.
api
.
NewMessage
(
""
,
types
.
EventReplyIsSync
,
&
types
.
IsCaughtUp
{
Iscaughtup
:
bc
.
IsCaughtUp
()}))
}
}
else
if
msg
.
Ty
==
types
.
EventMinerStart
{
}
else
if
msg
.
Ty
==
types
.
EventMinerStart
{
if
!
atomic
.
CompareAndSwapInt32
(
&
bc
.
minerStart
,
0
,
1
)
{
if
!
atomic
.
CompareAndSwapInt32
(
&
bc
.
minerStart
,
0
,
1
)
{
msg
.
ReplyErr
(
"EventMinerStart"
,
types
.
ErrMinerIsStared
)
msg
.
ReplyErr
(
"EventMinerStart"
,
types
.
ErrMinerIsStared
)
...
...
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