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
f4739e66
Commit
f4739e66
authored
Mar 25, 2020
by
mdj33
Committed by
33cn
Mar 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
genesis time support config
parent
ef360cb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
para.go
plugin/consensus/para/para.go
+7
-2
parasync.go
plugin/consensus/para/parasync.go
+3
-1
No files found.
plugin/consensus/para/para.go
View file @
f4739e66
...
@@ -33,7 +33,7 @@ import (
...
@@ -33,7 +33,7 @@ import (
const
(
const
(
minBlockNum
=
100
//min block number startHeight before lastHeight in mainchain
minBlockNum
=
100
//min block number startHeight before lastHeight in mainchain
g
enesisBlockTime
int64
=
1514533390
defaultG
enesisBlockTime
int64
=
1514533390
//current miner tx take any privatekey for unify all nodes sign purpose, and para chain is free
//current miner tx take any privatekey for unify all nodes sign purpose, and para chain is free
minerPrivateKey
=
"6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
minerPrivateKey
=
"6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
defaultGenesisAmount
int64
=
1e8
defaultGenesisAmount
int64
=
1e8
...
@@ -73,6 +73,7 @@ type subConfig struct {
...
@@ -73,6 +73,7 @@ type subConfig struct {
WriteBlockSeconds
int64
`json:"writeBlockSeconds,omitempty"`
WriteBlockSeconds
int64
`json:"writeBlockSeconds,omitempty"`
ParaRemoteGrpcClient
string
`json:"paraRemoteGrpcClient,omitempty"`
ParaRemoteGrpcClient
string
`json:"paraRemoteGrpcClient,omitempty"`
StartHeight
int64
`json:"startHeight,omitempty"`
StartHeight
int64
`json:"startHeight,omitempty"`
GenesisBlockTime
int64
`json:"genesisBlockTime,omitempty"`
GenesisStartHeightSame
bool
`json:"genesisStartHeightSame,omitempty"`
GenesisStartHeightSame
bool
`json:"genesisStartHeightSame,omitempty"`
EmptyBlockInterval
[]
string
`json:"emptyBlockInterval,omitempty"`
EmptyBlockInterval
[]
string
`json:"emptyBlockInterval,omitempty"`
AuthAccount
string
`json:"authAccount,omitempty"`
AuthAccount
string
`json:"authAccount,omitempty"`
...
@@ -107,6 +108,10 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
...
@@ -107,6 +108,10 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
subcfg
.
WriteBlockSeconds
=
poolMainBlockSec
subcfg
.
WriteBlockSeconds
=
poolMainBlockSec
}
}
if
subcfg
.
GenesisBlockTime
<=
0
{
subcfg
.
GenesisBlockTime
=
defaultGenesisBlockTime
}
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"
)
...
@@ -319,7 +324,7 @@ func (client *client) InitBlock() {
...
@@ -319,7 +324,7 @@ func (client *client) InitBlock() {
// 创世区块
// 创世区块
newblock
:=
&
types
.
Block
{}
newblock
:=
&
types
.
Block
{}
newblock
.
Height
=
0
newblock
.
Height
=
0
newblock
.
BlockTime
=
g
enesisBlockTime
newblock
.
BlockTime
=
client
.
subCfg
.
G
enesisBlockTime
newblock
.
ParentHash
=
zeroHash
[
:
]
newblock
.
ParentHash
=
zeroHash
[
:
]
newblock
.
MainHash
=
mainHash
newblock
.
MainHash
=
mainHash
...
...
plugin/consensus/para/parasync.go
View file @
f4739e66
...
@@ -414,7 +414,9 @@ func (client *blockSyncClient) addBlock(lastBlock *types.Block, localBlock *pt.P
...
@@ -414,7 +414,9 @@ func (client *blockSyncClient) addBlock(lastBlock *types.Block, localBlock *pt.P
newBlock
.
BlockTime
=
localBlock
.
BlockTime
newBlock
.
BlockTime
=
localBlock
.
BlockTime
newBlock
.
MainHash
=
localBlock
.
MainHash
newBlock
.
MainHash
=
localBlock
.
MainHash
newBlock
.
MainHeight
=
localBlock
.
MainHeight
newBlock
.
MainHeight
=
localBlock
.
MainHeight
if
newBlock
.
Height
==
1
&&
newBlock
.
BlockTime
<
client
.
paraClient
.
subCfg
.
GenesisBlockTime
{
panic
(
"genesisBlockTime bigger than the 1st block time, need rmv db and reset genesisBlockTime"
)
}
err
=
client
.
writeBlock
(
lastBlock
.
StateHash
,
&
newBlock
)
err
=
client
.
writeBlock
(
lastBlock
.
StateHash
,
&
newBlock
)
client
.
printDebugInfo
(
"Para sync - create new Block"
,
client
.
printDebugInfo
(
"Para sync - create new Block"
,
...
...
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