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
d4423f18
Commit
d4423f18
authored
Jun 02, 2020
by
madengji
Committed by
33cn
Jun 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new p2p proc file
parent
61a9b28e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
44 deletions
+53
-44
para.go
plugin/consensus/para/para.go
+0
-38
paraP2pProc.go
plugin/consensus/para/paraP2pProc.go
+53
-0
parablssign.go
plugin/consensus/para/parablssign.go
+0
-6
No files found.
plugin/consensus/para/para.go
View file @
d4423f18
...
@@ -27,7 +27,6 @@ import (
...
@@ -27,7 +27,6 @@ import (
paracross
"github.com/33cn/plugin/plugin/dapp/paracross/types"
paracross
"github.com/33cn/plugin/plugin/dapp/paracross/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/herumi/bls-eth-go-binary/bls"
"github.com/herumi/bls-eth-go-binary/bls"
"github.com/pkg/errors"
)
)
const
(
const
(
...
@@ -354,43 +353,6 @@ func (client *client) ProcEvent(msg *queue.Message) bool {
...
@@ -354,43 +353,6 @@ func (client *client) ProcEvent(msg *queue.Message) bool {
return
false
return
false
}
}
func
(
client
*
client
)
sendP2PMsg
(
ty
int64
,
data
interface
{})
([]
byte
,
error
)
{
msg
:=
client
.
GetQueueClient
()
.
NewMessage
(
"p2p"
,
ty
,
data
)
err
:=
client
.
GetQueueClient
()
.
Send
(
msg
,
true
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"ty=%d"
,
ty
)
}
resp
,
err
:=
client
.
GetQueueClient
()
.
Wait
(
msg
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"wait ty=%d"
,
ty
)
}
if
resp
.
GetData
()
.
(
*
types
.
Reply
)
.
IsOk
{
return
resp
.
GetData
()
.
(
*
types
.
Reply
)
.
Msg
,
nil
}
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"resp msg=%s"
,
string
(
resp
.
GetData
()
.
(
*
types
.
Reply
)
.
GetMsg
()))
}
// p2p订阅消息
func
(
client
*
client
)
SendPubP2PMsg
(
topic
string
,
msg
[]
byte
)
error
{
data
:=
&
types
.
PublishTopicMsg
{
Topic
:
topic
,
Msg
:
msg
}
_
,
err
:=
client
.
sendP2PMsg
(
types
.
EventPubTopicMsg
,
data
)
return
err
}
func
(
client
*
client
)
SendSubP2PTopic
(
topic
string
)
error
{
data
:=
&
types
.
SubTopic
{
Topic
:
topic
,
Module
:
"consensus"
}
_
,
err
:=
client
.
sendP2PMsg
(
types
.
EventSubTopic
,
data
)
return
err
}
func
(
client
*
client
)
SendRmvP2PTopic
(
topic
string
)
error
{
data
:=
&
types
.
RemoveTopic
{
Topic
:
topic
,
Module
:
"consensus"
}
_
,
err
:=
client
.
sendP2PMsg
(
types
.
EventRemoveTopic
,
data
)
return
err
}
func
(
client
*
client
)
isCaughtUp
()
bool
{
func
(
client
*
client
)
isCaughtUp
()
bool
{
return
atomic
.
LoadInt32
(
&
client
.
caughtUp
)
==
1
return
atomic
.
LoadInt32
(
&
client
.
caughtUp
)
==
1
}
}
...
...
plugin/consensus/para/paraP2pProc.go
0 → 100644
View file @
d4423f18
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
para
import
(
"github.com/33cn/chain33/types"
"github.com/pkg/errors"
)
//新增需要保证顺序
const
(
P2pSubCommitTx
=
1
P2pSubLeaderSyncMsg
=
2
)
func
(
client
*
client
)
sendP2PMsg
(
ty
int64
,
data
interface
{})
([]
byte
,
error
)
{
msg
:=
client
.
GetQueueClient
()
.
NewMessage
(
"p2p"
,
ty
,
data
)
err
:=
client
.
GetQueueClient
()
.
Send
(
msg
,
true
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"ty=%d"
,
ty
)
}
resp
,
err
:=
client
.
GetQueueClient
()
.
Wait
(
msg
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"wait ty=%d"
,
ty
)
}
if
resp
.
GetData
()
.
(
*
types
.
Reply
)
.
IsOk
{
return
resp
.
GetData
()
.
(
*
types
.
Reply
)
.
Msg
,
nil
}
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"resp msg=%s"
,
string
(
resp
.
GetData
()
.
(
*
types
.
Reply
)
.
GetMsg
()))
}
// p2p订阅消息
func
(
client
*
client
)
SendPubP2PMsg
(
topic
string
,
msg
[]
byte
)
error
{
data
:=
&
types
.
PublishTopicMsg
{
Topic
:
topic
,
Msg
:
msg
}
_
,
err
:=
client
.
sendP2PMsg
(
types
.
EventPubTopicMsg
,
data
)
return
err
}
func
(
client
*
client
)
SendSubP2PTopic
(
topic
string
)
error
{
data
:=
&
types
.
SubTopic
{
Topic
:
topic
,
Module
:
"consensus"
}
_
,
err
:=
client
.
sendP2PMsg
(
types
.
EventSubTopic
,
data
)
return
err
}
func
(
client
*
client
)
SendRmvP2PTopic
(
topic
string
)
error
{
data
:=
&
types
.
RemoveTopic
{
Topic
:
topic
,
Module
:
"consensus"
}
_
,
err
:=
client
.
sendP2PMsg
(
types
.
EventRemoveTopic
,
data
)
return
err
}
plugin/consensus/para/parablssign.go
View file @
d4423f18
...
@@ -30,12 +30,6 @@ const (
...
@@ -30,12 +30,6 @@ const (
paraBlsSignTopic
=
"PARA-BLS-SIGN-TOPIC"
paraBlsSignTopic
=
"PARA-BLS-SIGN-TOPIC"
)
)
//新增需要保证顺序
const
(
P2pSubCommitTx
=
1
P2pSubLeaderSyncMsg
=
2
)
type
blsClient
struct
{
type
blsClient
struct
{
paraClient
*
client
paraClient
*
client
selfID
string
selfID
string
...
...
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