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
a19fbdb0
Commit
a19fbdb0
authored
Jul 20, 2020
by
madengji
Committed by
33cn
Jul 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
genesisBlockTime
parent
6e938434
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
5 deletions
+30
-5
para.go
plugin/consensus/para/para.go
+7
-0
parablssign.go
plugin/consensus/para/parablssign.go
+8
-5
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+4
-0
parasync.go
plugin/consensus/para/parasync.go
+10
-0
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+1
-0
No files found.
plugin/consensus/para/para.go
View file @
a19fbdb0
...
@@ -109,6 +109,12 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
...
@@ -109,6 +109,12 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
subcfg
.
WriteBlockSeconds
=
poolMainBlockSec
subcfg
.
WriteBlockSeconds
=
poolMainBlockSec
}
}
//最初平行链toml GenesisBlockTime=1514533394,但是未被使用,一直使用的内置的1514533390,最新版本开始适配cfg.GenesisBlockTime,并且
//时间也缺省改为1514533390,支持修改时间, 如果有以前的旧的配置未修改,panic强制修改
if
cfg
.
GenesisBlockTime
==
1514533394
{
panic
(
"para chain GenesisBlockTime need be modified to 1514533390 or other"
)
}
emptyInterval
,
err
:=
parseEmptyBlockInterval
(
subcfg
.
EmptyBlockInterval
)
emptyInterval
,
err
:=
parseEmptyBlockInterval
(
subcfg
.
EmptyBlockInterval
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
"para EmptyBlockInterval config not correct"
)
panic
(
"para EmptyBlockInterval config not correct"
)
...
@@ -240,6 +246,7 @@ func (client *client) InitBlock() {
...
@@ -240,6 +246,7 @@ func (client *client) InitBlock() {
if
client
.
cfg
.
GenesisBlockTime
>
0
{
if
client
.
cfg
.
GenesisBlockTime
>
0
{
newblock
.
BlockTime
=
client
.
cfg
.
GenesisBlockTime
newblock
.
BlockTime
=
client
.
cfg
.
GenesisBlockTime
}
}
newblock
.
ParentHash
=
zeroHash
[
:
]
newblock
.
ParentHash
=
zeroHash
[
:
]
newblock
.
MainHash
=
mainHash
newblock
.
MainHash
=
mainHash
...
...
plugin/consensus/para/parablssign.go
View file @
a19fbdb0
...
@@ -6,7 +6,6 @@ package para
...
@@ -6,7 +6,6 @@ package para
import
(
import
(
"bytes"
"bytes"
"fmt"
"sort"
"sort"
"strings"
"strings"
"sync"
"sync"
...
@@ -146,10 +145,13 @@ func (b *blsClient) rcvLeaderSyncTx(sync *pt.LeaderSyncInfo) error {
...
@@ -146,10 +145,13 @@ func (b *blsClient) rcvLeaderSyncTx(sync *pt.LeaderSyncInfo) error {
}
}
//如果leader节点冲突,取大者
//如果leader节点冲突,取大者
if
isLeader
&&
off
>
sync
.
Offset
{
if
isLeader
&&
off
>
sync
.
Offset
{
return
errors
.
Wrapf
(
types
.
ErrNotSync
,
"self
leader off=%d bigger than
sync=%d"
,
off
,
sync
.
Offset
)
return
errors
.
Wrapf
(
types
.
ErrNotSync
,
"self
is leader, off=%d bigger than peer
sync=%d"
,
off
,
sync
.
Offset
)
}
}
//更新同步过来的最新offset 高度
//更新同步过来的最新offset 高度
atomic
.
StoreInt32
(
&
b
.
leaderOffset
,
sync
.
Offset
)
if
off
!=
sync
.
Offset
{
atomic
.
StoreInt32
(
&
b
.
leaderOffset
,
sync
.
Offset
)
plog
.
Error
(
"rcvLeaderSyncTx sync to peer"
,
"offset"
,
sync
.
Offset
)
}
//两节点不同步则不喂狗,以防止非同步或作恶节点喂狗
//两节点不同步则不喂狗,以防止非同步或作恶节点喂狗
atomic
.
StoreUint32
(
&
b
.
feedDog
,
1
)
atomic
.
StoreUint32
(
&
b
.
feedDog
,
1
)
...
@@ -548,14 +550,15 @@ func (b *blsClient) showTxBuffInfo() *pt.ParaBlsSignSumInfo {
...
@@ -548,14 +550,15 @@ func (b *blsClient) showTxBuffInfo() *pt.ParaBlsSignSumInfo {
b
.
mutex
.
Lock
()
b
.
mutex
.
Lock
()
defer
b
.
mutex
.
Unlock
()
defer
b
.
mutex
.
Unlock
()
var
ret
pt
.
ParaBlsSignSumInfo
reply
,
err
:=
b
.
paraClient
.
SendFetchP2PTopic
()
reply
,
err
:=
b
.
paraClient
.
SendFetchP2PTopic
()
if
err
!=
nil
{
if
err
!=
nil
{
plog
.
Error
(
"fetch p2p topic"
,
"err"
,
err
)
plog
.
Error
(
"fetch p2p topic"
,
"err"
,
err
)
}
}
plog
.
Info
(
"fetch p2p topics"
,
"list"
,
fmt
.
Sprint
(
reply
.
Topics
)
)
ret
.
Topics
=
append
(
ret
.
Topics
,
reply
.
Topics
...
)
var
seq
[]
int64
var
seq
[]
int64
var
ret
pt
.
ParaBlsSignSumInfo
for
k
:=
range
b
.
commitsPool
{
for
k
:=
range
b
.
commitsPool
{
seq
=
append
(
seq
,
k
)
seq
=
append
(
seq
,
k
)
}
}
...
...
plugin/consensus/para/paracommitmsg.go
View file @
a19fbdb0
...
@@ -149,6 +149,10 @@ func (client *commitMsgClient) updateChainHeightNotify(height int64, isDel bool)
...
@@ -149,6 +149,10 @@ func (client *commitMsgClient) updateChainHeightNotify(height int64, isDel bool)
client
.
createCommitTx
()
client
.
createCommitTx
()
}
}
func
(
client
*
commitMsgClient
)
setInitChainHeight
(
height
int64
)
{
atomic
.
StoreInt64
(
&
client
.
chainHeight
,
height
)
}
// reset notify 提供重设发送参数,发送tx的入口
// reset notify 提供重设发送参数,发送tx的入口
func
(
client
*
commitMsgClient
)
resetNotify
()
{
func
(
client
*
commitMsgClient
)
resetNotify
()
{
client
.
resetCh
<-
1
client
.
resetCh
<-
1
...
...
plugin/consensus/para/parasync.go
View file @
a19fbdb0
...
@@ -573,4 +573,14 @@ func (client *blockSyncClient) syncInit() {
...
@@ -573,4 +573,14 @@ func (client *blockSyncClient) syncInit() {
if
err
!=
nil
{
if
err
!=
nil
{
client
.
printError
(
err
)
client
.
printError
(
err
)
}
}
//设置初始chainHeight,及时发送共识,不然需要等到再产生一个新块才发送
lastBlock
,
err
:=
client
.
paraClient
.
getLastBlockInfo
()
if
err
!=
nil
{
//取已执行最新区块发生错误,不做任何操作
plog
.
Info
(
"Para sync init"
,
"err"
,
err
)
}
else
{
client
.
paraClient
.
commitMsgClient
.
setInitChainHeight
(
lastBlock
.
Height
)
}
}
}
plugin/dapp/paracross/proto/paracross.proto
View file @
a19fbdb0
...
@@ -431,6 +431,7 @@ message ParaBlsSignSumDetailsShow {
...
@@ -431,6 +431,7 @@ message ParaBlsSignSumDetailsShow {
}
}
message
ParaBlsSignSumInfo
{
message
ParaBlsSignSumInfo
{
repeated
ParaBlsSignSumDetailsShow
info
=
1
;
repeated
ParaBlsSignSumDetailsShow
info
=
1
;
repeated
string
topics
=
2
;
}
}
message
LeaderSyncInfo
{
message
LeaderSyncInfo
{
...
...
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