Commit 7d2bc855 authored by mdj33's avatar mdj33 Committed by vipwzw

code improve

parent 2d38ee7d
...@@ -930,7 +930,7 @@ func parseSelfConsEnableStr(selfEnables []string) ([]*paraSelfConsEnable, error) ...@@ -930,7 +930,7 @@ func parseSelfConsEnableStr(selfEnables []string) ([]*paraSelfConsEnable, error)
func (client *commitMsgClient) setSelfConsEnable() error { func (client *commitMsgClient) setSelfConsEnable() error {
cfg := client.paraClient.GetAPI().GetConfig() cfg := client.paraClient.GetAPI().GetConfig()
selfEnables := types.Conf(cfg, "config.consensus.sub.para").GStrList("selfConsensEnablePreContract") selfEnables := types.Conf(cfg, pt.ParaPrefixConsSubConf).GStrList(pt.ParaSelfConsConfPreContract)
list, err := parseSelfConsEnableStr(selfEnables) list, err := parseSelfConsEnableStr(selfEnables)
if err != nil { if err != nil {
return err return err
......
...@@ -60,7 +60,7 @@ func filterParaTxGroup(cfg *types.Chain33Config, tx *types.Transaction, allTxs [ ...@@ -60,7 +60,7 @@ func filterParaTxGroup(cfg *types.Chain33Config, tx *types.Transaction, allTxs [
endIdx := headIdx + int(tx.GroupCount) endIdx := headIdx + int(tx.GroupCount)
for i := headIdx; i < endIdx; i++ { for i := headIdx; i < endIdx; i++ {
//缺省是在forkHeight之前与更老版本一致,不检查平行链交易,但有些特殊平行链6.2.0版本升级上来无更老版本且要求blockhash不变,则需与6.2.0保持一致,不检查 //缺省是在forkHeight之前与更老版本一致,不检查平行链交易,但有些特殊平行链6.2.0版本升级上来无更老版本且要求blockhash不变,则需与6.2.0保持一致,不检查
if cfg.IsPara() && mainBlockHeight < forkHeight && !types.Conf(cfg, "config.consensus.sub.para").IsEnable("FilterIgnoreParaTxGroup") { if cfg.IsPara() && mainBlockHeight < forkHeight && !types.Conf(cfg, pt.ParaPrefixConsSubConf).IsEnable(pt.ParaFilterIgnoreTxGroup) {
if types.IsParaExecName(string(allTxs[i].Tx.Execer)) { if types.IsParaExecName(string(allTxs[i].Tx.Execer)) {
continue continue
} }
......
...@@ -137,7 +137,7 @@ func updateStages(db dbm.KV, stage *pt.SelfConsensStage) (*types.Receipt, error) ...@@ -137,7 +137,7 @@ func updateStages(db dbm.KV, stage *pt.SelfConsensStage) (*types.Receipt, error)
} }
func selfConsensInitStage(cfg *types.Chain33Config) *types.Receipt { func selfConsensInitStage(cfg *types.Chain33Config) *types.Receipt {
close := cfg.IsEnable("consensus.sub.para.paraSelfConsInitDisable") close := cfg.IsEnable(pt.ParaConsSubConf + "." + pt.ParaSelfConsInitConf)
stage := &pt.SelfConsensStage{BlockHeight: 0, Enable: pt.ParaConfigYes} stage := &pt.SelfConsensStage{BlockHeight: 0, Enable: pt.ParaConfigYes}
if close { if close {
stage.Enable = pt.ParaConfigNo stage.Enable = pt.ParaConfigNo
......
...@@ -354,7 +354,7 @@ func GetDappForkHeight(cfg *types.Chain33Config, forkKey string) int64 { ...@@ -354,7 +354,7 @@ func GetDappForkHeight(cfg *types.Chain33Config, forkKey string) int64 {
key = MainLoopCheckCommitTxDoneForkHeight key = MainLoopCheckCommitTxDoneForkHeight
} }
forkHeight = types.Conf(cfg, "config.consensus.sub.para").GInt(key) forkHeight = types.Conf(cfg, ParaPrefixConsSubConf).GInt(key)
if forkHeight <= 0 { if forkHeight <= 0 {
forkHeight = types.MaxHeight forkHeight = types.MaxHeight
} }
......
...@@ -28,7 +28,19 @@ var ( ...@@ -28,7 +28,19 @@ var (
ForkConsensSupportJump = "ForkConsensSupportJump" ForkConsensSupportJump = "ForkConsensSupportJump"
// ForkParaSelfConsStages 平行链自共识分阶段共识 // ForkParaSelfConsStages 平行链自共识分阶段共识
ForkParaSelfConsStages = "ForkParaSelfConsStages" ForkParaSelfConsStages = "ForkParaSelfConsStages"
)
//para toml config params
// ParaConsSubConf sub
ParaConsSubConf = "consensus.sub.para"
//ParaPrefixConsSubConf prefix
ParaPrefixConsSubConf = "config." + ParaConsSubConf
//ParaSelfConsInitConf self stage init config
ParaSelfConsInitConf = "paraSelfConsInitDisable"
//ParaSelfConsConfPreContract self consens enable string as ["0-100"] config pre stage contract
ParaSelfConsConfPreContract = "selfConsensEnablePreContract"
//ParaFilterIgnoreTxGroup adapt 6.1.0 to check para tx in group
ParaFilterIgnoreTxGroup = "FilterIgnoreParaTxGroup"
)
func init() { func init() {
// init executor type // init executor type
......
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