Commit d82063da authored by mdj33's avatar mdj33 Committed by vipwzw

selfConsensEnable fork

parent 29118e1d
......@@ -81,6 +81,7 @@ function base_init() {
sed -i $sedfix 's/^powLimitBits=.*/powLimitBits="0x1f2fffff"/g' chain33.toml
sed -i $sedfix 's/^targetTimePerBlock=.*/targetTimePerBlock=1/g' chain33.toml
sed -i $sedfix 's/^targetTimespan=.*/targetTimespan=10000000/g' chain33.toml
sed -i $sedfix 's/^isLevelFee=.*/isLevelFee=false/g' chain33.toml
# p2p
sed -i $sedfix 's/^seeds=.*/seeds=["chain33:13802","chain32:13802","chain31:13802"]/g' chain33.toml
......
......@@ -33,13 +33,12 @@ const (
genesisBlockTime int64 = 1514533390
//current miner tx take any privatekey for unify all nodes sign purpose, and para chain is free
minerPrivateKey = "6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
defaultGenesisAmount int64 = 1e8
poolMainBlockSec int64 = 5
defaultEmptyBlockInterval int64 = 50 //write empty block every interval blocks in mainchain
defaultSearchMatchedBlockDepth int32 = 10000
defaultMainBlockHashForkHeight int64 = 209186 //calc block hash fork height in main chain
mainParaSelfConsensusForkHeight int64 = types.MaxHeight //para chain self consensus height switch, must >= ForkParacrossCommitTx of main
minerPrivateKey = "6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
defaultGenesisAmount int64 = 1e8
poolMainBlockSec int64 = 5
defaultEmptyBlockInterval int64 = 50 //write empty block every interval blocks in mainchain
defaultSearchMatchedBlockDepth int32 = 10000
defaultMainBlockHashForkHeight int64 = 209186 //calc block hash fork height in main chain
)
var (
......
......@@ -708,8 +708,20 @@ func (a *action) isAllowMainConsensJump(commit *pt.ParacrossHeightStatus, titleS
}
//平行链自共识无缝切换条件:commit height为自共识分段起始高度
//分叉高度按平行链本身高度判断,而不是按主链高度,可以尽早支持isStartHeight标志,没共识过的平行链采用分段结构,可以从0开始,分叉高度也为0,
//共识过的平行链,由于之前按主链高度判断,创世0区块固定只在主链共识,平行链需要自动从1高度或更高高度过渡过来
func (a *action) isAllowParaConsensJump(commit *pt.ParacrossCommitAction, titleStatus *pt.ParacrossStatus) (bool, error) {
return commit.Status.IsStartHeight, nil
if commit.Status.IsStartHeight || types.IsDappFork(a.height, pt.ParaX, pt.ForkConsensSupportJump) {
return commit.Status.IsStartHeight, nil
}
return a.isAllowParaConsensJumpOld(commit, titleStatus)
}
//平行链自共识无缝切换条件:1,平行链没有共识过,2:commit高度是大于自共识分叉高度且上一次共识的主链高度小于自共识分叉高度,保证只运行一次,
// 这样在主链没有共识空洞前提下,平行链允许有条件的共识跳跃
func (a *action) isAllowParaConsensJumpOld(commit *pt.ParacrossCommitAction, titleStatus *pt.ParacrossStatus) (bool, error) {
return titleStatus.Height == -1, nil
}
func (a *action) isAllowConsensJump(commit *pt.ParacrossCommitAction, titleStatus *pt.ParacrossStatus) (bool, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment