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
0b7ef948
Commit
0b7ef948
authored
Jul 16, 2021
by
mdj33
Committed by
vipwzw
Jul 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
para start wait height config
parent
998d1f1b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
chain33.para.toml
chain33.para.toml
+2
-2
para.go
plugin/consensus/para/para.go
+9
-3
No files found.
chain33.para.toml
View file @
0b7ef948
...
...
@@ -110,14 +110,14 @@ halvePeriod=1000
ParaRemoteGrpcClient
=
"localhost:8802"
#主链指定高度的区块开始同步
startHeight
=
345850
#主链指定高度后等待块数,防止主链回滚,联盟链最小为1,小于1则采用缺省高度100
#waitMainBlockNum=100
#打包时间间隔,单位秒
writeBlockSeconds
=
2
#验证账户,验证节点需要配置自己的账户,并且钱包导入对应种子,非验证节点留空
authAccount
=
""
#创世地址额度
genesisAmount
=
100000000
#创世区块时间,新部署链可以修改,缺省2017/12/29
#genesisBlockTime=1514533390
#主链计算blockhash forkheight,需要和主链保持严格一致,不可修改,209186是bityuan主链对应高度, ycc或其他按实际修改
mainBlockHashForkHeight
=
209186
#主链支持平行链共识tx分叉高度,需要和主链保持严格一致,不可修改,2270000是bityuan主链对应高度, ycc或其他按实际修改
...
...
plugin/consensus/para/para.go
View file @
0b7ef948
...
...
@@ -29,7 +29,7 @@ import (
)
const
(
m
inBlockNum
=
100
//min block number startHeight before lastHeight in mainchain
defaultWaitM
inBlockNum
=
100
//min block number startHeight before lastHeight in mainchain
defaultGenesisBlockTime
int64
=
1514533390
//current miner tx take any privatekey for unify all nodes sign purpose, and para chain is free
...
...
@@ -73,6 +73,7 @@ type subConfig struct {
WriteBlockSeconds
int64
`json:"writeBlockSeconds,omitempty"`
ParaRemoteGrpcClient
string
`json:"paraRemoteGrpcClient,omitempty"`
StartHeight
int64
`json:"startHeight,omitempty"`
WaitMainBlockNum
int64
`json:"waitMainBlockNum,omitempty"`
GenesisStartHeightSame
bool
`json:"genesisStartHeightSame,omitempty"`
EmptyBlockInterval
[]
string
`json:"emptyBlockInterval,omitempty"`
AuthAccount
string
`json:"authAccount,omitempty"`
...
...
@@ -109,6 +110,11 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
subcfg
.
WriteBlockSeconds
=
poolMainBlockSec
}
//WaitMainBlockNum 配置最小为1,因为genesis块是startHeight-1, wait=1和startHeight相等
if
subcfg
.
WaitMainBlockNum
<=
0
{
subcfg
.
WaitMainBlockNum
=
defaultWaitMinBlockNum
}
//最初平行链toml GenesisBlockTime=1514533394,但是未被使用,一直使用的内置的1514533390,最新版本开始适配cfg.GenesisBlockTime,并且
//时间也缺省改为1514533390,支持修改时间, 如果有以前的旧的配置未修改,panic强制修改
if
cfg
.
GenesisBlockTime
==
1514533394
{
...
...
@@ -287,7 +293,7 @@ func (client *client) GetStartMainHash(height int64) []byte {
if
height
>
0
{
hint
:=
time
.
NewTicker
(
time
.
Second
*
time
.
Duration
(
client
.
subCfg
.
WriteBlockSeconds
))
for
lastHeight
<
height
+
m
inBlockNum
{
for
lastHeight
<
height
+
client
.
subCfg
.
WaitMa
inBlockNum
{
select
{
case
<-
hint
.
C
:
plog
.
Info
(
"Waiting lastHeight increase......"
,
"lastHeight"
,
lastHeight
,
"startHeight"
,
height
)
...
...
@@ -300,7 +306,7 @@ func (client *client) GetStartMainHash(height int64) []byte {
}
}
hint
.
Stop
()
plog
.
Info
(
fmt
.
Sprintf
(
"lastHeight more than %d blocks after startHeight"
,
m
inBlockNum
),
"lastHeight"
,
lastHeight
,
"startHeight"
,
height
)
plog
.
Info
(
fmt
.
Sprintf
(
"lastHeight more than %d blocks after startHeight"
,
client
.
subCfg
.
WaitMa
inBlockNum
),
"lastHeight"
,
lastHeight
,
"startHeight"
,
height
)
}
hash
,
err
:=
client
.
GetHashByHeightOnMainChain
(
height
)
...
...
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