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
1c8c5a8d
Commit
1c8c5a8d
authored
Jan 23, 2019
by
mdj33
Committed by
vipwzw
Jan 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
paracross adapt multi grpc ip
parent
f942309a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
para.go
plugin/consensus/para/para.go
+14
-10
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+15
-3
No files found.
plugin/consensus/para/para.go
View file @
1c8c5a8d
...
...
@@ -16,16 +16,17 @@ import (
//"github.com/33cn/chain33/common"
"encoding/hex"
"github.com/33cn/chain33/client/api"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/merkle"
"github.com/33cn/chain33/queue"
"github.com/33cn/chain33/rpc/grpcclient"
drivers
"github.com/33cn/chain33/system/consensus"
cty
"github.com/33cn/chain33/system/dapp/coins/types"
"github.com/33cn/chain33/types"
paracross
"github.com/33cn/plugin/plugin/dapp/paracross/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
"google.golang.org/grpc"
)
const
(
...
...
@@ -59,9 +60,9 @@ func init() {
type
client
struct
{
*
drivers
.
BaseClient
conn
*
grpc
.
ClientConn
grpcClient
types
.
Chain33Client
paraClient
paracross
.
ParacrossClient
execAPI
api
.
ExecutorAPI
isCaughtUp
bool
commitMsgClient
*
commitMsgClient
authAccount
string
...
...
@@ -122,20 +123,22 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
plog
.
Debug
(
"New Para consensus client"
)
msgRecvOp
:=
grpc
.
WithMaxMsgSize
(
grpcRecSize
)
conn
,
err
:=
grpc
.
Dial
(
grpcSite
,
grpc
.
WithInsecure
(),
msgRecvOp
)
//msgRecvOp := grpc.WithMaxMsgSize(grpcRecSize)
//conn, err := grpc.Dial(grpcSite, grpc.WithInsecure(), msgRecvOp)
//if err != nil {
// panic(err)
//}
//_ = types.NewChain33Client(conn)
//grpcClient := types.NewChain33Client(conn)
grpcCli
,
err
:=
grpcclient
.
NewMainChainClient
(
grpcSite
)
if
err
!=
nil
{
panic
(
err
)
}
grpcClient
:=
types
.
NewChain33Client
(
conn
)
paraCli
:=
paracross
.
NewParacrossClient
(
conn
)
para
:=
&
client
{
BaseClient
:
c
,
conn
:
conn
,
grpcClient
:
grpcClient
,
paraClient
:
paraCli
,
grpcClient
:
grpcCli
,
authAccount
:
subcfg
.
AuthAccount
,
privateKey
:
priKey
,
isCaughtUp
:
false
,
...
...
@@ -166,7 +169,6 @@ func (client *client) Close() {
client
.
BaseClient
.
Close
()
close
(
client
.
commitMsgClient
.
quit
)
client
.
wg
.
Wait
()
client
.
conn
.
Close
()
plog
.
Info
(
"consensus para closed"
)
}
...
...
@@ -189,6 +191,8 @@ func (client *client) InitBlock() {
panic
(
err
)
}
client
.
execAPI
=
api
.
New
(
client
.
BaseClient
.
GetAPI
(),
client
.
grpcClient
)
block
,
err
:=
client
.
RequestLastBlock
()
if
err
!=
nil
{
panic
(
err
)
...
...
plugin/consensus/para/paracommitmsg.go
View file @
1c8c5a8d
...
...
@@ -475,14 +475,26 @@ out:
isSync
=
true
}
ret
,
err
:=
client
.
paraClient
.
paraClient
.
GetTitle
(
context
.
Background
(),
&
types
.
ReqString
{
Data
:
types
.
GetTitle
()})
//ret, err := client.paraClient.paraClient.GetTitle(context.Background(),
// &types.ReqString{Data: types.GetTitle()})
var
req
types
.
ChainExecutor
req
.
Driver
=
"paracross"
req
.
FuncName
=
"GetTitle"
req
.
Param
=
types
.
Encode
(
&
types
.
ReqString
{
Data
:
types
.
GetTitle
()})
ret
,
err
:=
client
.
paraClient
.
grpcClient
.
QueryChain
(
context
.
Background
(),
&
req
)
if
err
!=
nil
{
plog
.
Error
(
"getConsensusHeight "
,
"err"
,
err
.
Error
())
continue
}
if
!
ret
.
GetIsOk
()
{
plog
.
Info
(
"getConsensusHeight"
,
"error"
,
ret
.
GetMsg
())
continue
}
var
result
pt
.
ParacrossStatus
types
.
Decode
(
ret
.
Msg
,
&
result
)
consensusRst
<-
re
t
consensusRst
<-
&
resul
t
}
}
...
...
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