Commit 721cfedf authored by mdj33's avatar mdj33 Committed by vipwzw

cut commit status parameter

parent 5be6fba4
......@@ -687,12 +687,15 @@ func (client *client) addMinerTx(preStateHash []byte, block *types.Block, main *
status := &pt.ParacrossNodeStatus{
Title: types.GetTitle(),
Height: block.Height,
PreBlockHash: block.ParentHash,
PreStateHash: preStateHash,
MainBlockHash: main.Seq.Hash,
MainBlockHeight: main.Detail.Block.Height,
}
if !paracross.IsParaForkHeight(status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
status.PreBlockHash = block.ParentHash
status.PreStateHash = preStateHash
}
tx, err := pt.CreateRawMinerTx(&pt.ParacrossMinerAction{
Status: status,
IsSelfConsensus: isParaSelfConsensusForked(status.MainBlockHeight),
......
......@@ -445,7 +445,6 @@ func (client *commitMsgClient) getNodeStatus(start, end int64) ([]*pt.ParacrossN
return nil, errors.New("paracommitmsg wrong block result")
}
nodeList[block.Block.Height].BlockHash = block.Block.Hash()
nodeList[block.Block.Height].StateHash = block.Block.StateHash
}
var needSentTxs uint32
......@@ -462,6 +461,11 @@ func (client *commitMsgClient) getNodeStatus(start, end int64) ([]*pt.ParacrossN
return nil, nil
}
//clear flag
for _, v := range ret {
v.NonCommitTxCounts = 0
}
return ret, nil
}
......@@ -479,10 +483,8 @@ func (client *commitMsgClient) getGenesisNodeStatus() (*pt.ParacrossNodeStatus,
}
status.Title = types.GetTitle()
status.Height = block.Height
status.PreBlockHash = zeroHash[:]
status.BlockHash = block.Hash()
status.PreStateHash = zeroHash[:]
status.StateHash = block.StateHash
return &status, nil
}
......
......@@ -100,9 +100,9 @@ func checkCommitInfo(commit *pt.ParacrossCommitAction) error {
return types.ErrInvalidParam
}
clog.Debug("paracross.Commit check input", "height", commit.Status.Height, "mainHeight", commit.Status.MainBlockHeight,
"mainHash", hex.EncodeToString(commit.Status.MainBlockHash), "blockHash", hex.EncodeToString(commit.Status.BlockHash),
"preBlockHash", hex.EncodeToString(commit.Status.PreBlockHash))
"mainHash", hex.EncodeToString(commit.Status.MainBlockHash), "blockHash", hex.EncodeToString(commit.Status.BlockHash))
if !pt.IsParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
if commit.Status.Height == 0 {
if len(commit.Status.Title) == 0 || len(commit.Status.BlockHash) == 0 {
return types.ErrInvalidParam
......@@ -114,6 +114,18 @@ func checkCommitInfo(commit *pt.ParacrossCommitAction) error {
len(commit.Status.StateHash) == 0 || len(commit.Status.PreStateHash) == 0 {
return types.ErrInvalidParam
}
return nil
}
if commit.Status.Height == 0 {
if len(commit.Status.Title) == 0 || len(commit.Status.BlockHash) == 0 {
return types.ErrInvalidParam
}
return nil
}
if len(commit.Status.MainBlockHash) == 0 || commit.Status.Height < 0 || len(commit.Status.BlockHash) == 0 {
return types.ErrInvalidParam
}
return nil
}
......@@ -182,13 +194,8 @@ func makeDoneReceipt(execMainHeight int64, commit *pt.ParacrossNodeStatus,
MostSameCommit: most,
Title: commit.Title,
Height: commit.Height,
StateHash: commit.StateHash,
BlockHash: commit.BlockHash,
TxCounts: commit.TxCounts,
TxResult: commit.TxResult,
TxHashs: commit.TxHashs,
CrossTxHashs: commit.CrossTxHashs,
CrossTxResult: commit.CrossTxResult,
MainBlockHeight: commit.MainBlockHeight,
MainBlockHash: commit.MainBlockHash,
}
......@@ -198,7 +205,7 @@ func makeDoneReceipt(execMainHeight int64, commit *pt.ParacrossNodeStatus,
Height: commit.Height,
BlockHash: commit.BlockHash,
}
if execMainHeight >= getDappForkHeight(pt.ForkLoopCheckCommitTxDone) {
if execMainHeight >= pt.GetDappForkHeight(pt.ForkLoopCheckCommitTxDone) {
status.MainHeight = commit.MainBlockHeight
status.MainHash = commit.MainBlockHash
}
......@@ -238,13 +245,13 @@ func getMostCommit(stat *pt.ParacrossHeightStatus) (int, string) {
}
//需要在ForkLoopCheckCommitTxDone后使用
func getMostResults(mostHash []byte, stat *pt.ParacrossHeightStatus) ([]byte, []byte, []byte, []byte, []byte) {
func getMostResults(mostHash []byte, stat *pt.ParacrossHeightStatus) []byte {
for i, hash := range stat.BlockDetails.BlockHashs {
if bytes.Equal(mostHash, hash) {
return stat.BlockDetails.StateHashs[i], stat.BlockDetails.TxResults[i], stat.BlockDetails.TxHashs[i], stat.BlockDetails.CrossTxResults[i], stat.BlockDetails.CrossTxHashs[i]
return stat.BlockDetails.TxResults[i]
}
}
return nil, nil, nil, nil, nil
return nil
}
func hasCommited(addrs []string, addr string) (bool, int) {
......@@ -256,41 +263,6 @@ func hasCommited(addrs []string, addr string) (bool, int) {
return false, 0
}
func getDappForkHeight(forkKey string) int64 {
var forkHeight int64
if types.IsPara() {
key := forkKey
switch forkKey {
case pt.ForkCommitTx:
key = pt.MainForkParacrossCommitTx
case pt.ForkLoopCheckCommitTxDone:
key = pt.MainLoopCheckCommitTxDoneForkHeight
}
forkHeight = types.Conf("config.consensus.sub.para").GInt(key)
if forkHeight <= 0 {
forkHeight = types.MaxHeight
}
} else {
forkHeight = types.GetDappFork(pt.ParaX, forkKey)
// CI特殊处理,主链是local,fork都是0,平行链有些配置项需要设置为非0,不然获取到的高度为MaxHeight
if types.IsLocal() {
switch forkKey {
case pt.ForkCommitTx:
forkHeight = 10
case pt.ForkLoopCheckCommitTxDone:
forkHeight = 60
}
}
}
return forkHeight
}
func isParaForkHeight(height int64, forkKey string) bool {
return height >= getDappForkHeight(forkKey)
}
func getConfigNodes(db dbm.KV, title string) (map[string]struct{}, []byte, error) {
key := calcParaNodeGroupAddrsKey(title)
nodes, _, err := getNodes(db, key)
......@@ -309,7 +281,7 @@ func getConfigNodes(db dbm.KV, title string) (map[string]struct{}, []byte, error
}
func (a *action) getNodesGroup(title string) (map[string]struct{}, error) {
if a.exec.GetMainHeight() < getDappForkHeight(pt.ForkCommitTx) {
if a.exec.GetMainHeight() < pt.GetDappForkHeight(pt.ForkCommitTx) {
nodes, _, err := getConfigManageNodes(a.db, title)
if err != nil {
return nil, errors.Wrapf(err, "getNodes for title:%s", title)
......@@ -330,11 +302,8 @@ func updateCommitBlockHashs(stat *pt.ParacrossHeightStatus, commit *pt.Paracross
}
}
stat.BlockDetails.BlockHashs = append(stat.BlockDetails.BlockHashs, commit.BlockHash)
stat.BlockDetails.StateHashs = append(stat.BlockDetails.StateHashs, commit.StateHash)
stat.BlockDetails.TxResults = append(stat.BlockDetails.TxResults, commit.TxResult)
stat.BlockDetails.TxHashs = append(stat.BlockDetails.TxHashs, commit.TxHashs[0])
stat.BlockDetails.CrossTxResults = append(stat.BlockDetails.CrossTxResults, commit.CrossTxResult)
stat.BlockDetails.CrossTxHashs = append(stat.BlockDetails.CrossTxHashs, commit.CrossTxHashs[0])
}
//根据nodes过滤掉可能退出了的addrs
......@@ -374,7 +343,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
return nil, errors.Wrapf(err, "getTitle:%s", a.fromaddr)
}
if titleStatus.Height+1 == commit.Status.Height && commit.Status.Height > 0 {
if titleStatus.Height+1 == commit.Status.Height && commit.Status.Height > 0 && !pt.IsParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
if !bytes.Equal(titleStatus.BlockHash, commit.Status.PreBlockHash) {
clog.Error("paracross.Commit", "check PreBlockHash", hex.EncodeToString(titleStatus.BlockHash),
"commit tx", hex.EncodeToString(commit.Status.PreBlockHash), "commitheit", commit.Status.Height,
......@@ -431,13 +400,13 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
BlockHash: [][]byte{commit.Status.BlockHash},
},
}
if isParaForkHeight(a.exec.GetMainHeight(), pt.ForkCommitTx) {
if pt.IsParaForkHeight(a.exec.GetMainHeight(), pt.ForkCommitTx) {
stat.MainHeight = commit.Status.MainBlockHeight
stat.MainHash = commit.Status.MainBlockHash
}
//用commit.MainBlockHeight 判断更准确,如果用a.exec.MainHeight也可以,但是可能收到MainHeight之前的高度共识tx,
// 后面loopCommitTxDone时候也是用当前共识高度大于分叉高度判断
if isParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
if pt.IsParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
stat.BlockDetails = &pt.ParacrossStatusBlockDetails{}
updateCommitBlockHashs(stat, commit.Status)
}
......@@ -454,13 +423,13 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
found, index := hasCommited(stat.Details.Addrs, a.fromaddr)
if found {
stat.Details.BlockHash[index] = commit.Status.BlockHash
if isParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
if pt.IsParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
updateCommitBlockHashs(stat, commit.Status)
}
} else {
stat.Details.Addrs = append(stat.Details.Addrs, a.fromaddr)
stat.Details.BlockHash = append(stat.Details.BlockHash, commit.Status.BlockHash)
if isParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
if pt.IsParaForkHeight(commit.Status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
updateCommitBlockHashs(stat, commit.Status)
}
}
......@@ -473,7 +442,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
}
saveTitleHeight(a.db, calcTitleHeightKey(stat.Title, stat.Height), stat)
//fork之前记录的stat 没有根据nodes更新而更新
if isParaForkHeight(stat.MainHeight, pt.ForkLoopCheckCommitTxDone) {
if pt.IsParaForkHeight(stat.MainHeight, pt.ForkLoopCheckCommitTxDone) {
r := makeCommitStatReceipt(stat)
receipt = mergeReceipt(receipt, r)
}
......@@ -517,7 +486,7 @@ func (a *action) commitTxDone(nodeStatus *pt.ParacrossNodeStatus, stat *pt.Parac
saveTitleHeight(a.db, calcTitleHeightKey(stat.Title, stat.Height), stat)
//之前记录的stat 状态没更新
if isParaForkHeight(stat.MainHeight, pt.ForkLoopCheckCommitTxDone) {
if pt.IsParaForkHeight(stat.MainHeight, pt.ForkLoopCheckCommitTxDone) {
r := makeCommitStatReceipt(stat)
receipt = mergeReceipt(receipt, r)
}
......@@ -540,7 +509,7 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
titleStatus.Title = nodeStatus.Title
titleStatus.Height = nodeStatus.Height
titleStatus.BlockHash = nodeStatus.BlockHash
if isParaForkHeight(a.exec.GetMainHeight(), pt.ForkLoopCheckCommitTxDone) {
if pt.IsParaForkHeight(a.exec.GetMainHeight(), pt.ForkLoopCheckCommitTxDone) {
titleStatus.MainHeight = nodeStatus.MainBlockHeight
titleStatus.MainHash = nodeStatus.MainBlockHash
}
......@@ -571,14 +540,24 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
return receipt, nil
}
func (a *action) procCrossTxs(status *pt.ParacrossNodeStatus) (*types.Receipt, error) {
func isHaveCrossTxs(status *pt.ParacrossNodeStatus) bool {
//ForkLoopCheckCommitTxDone分叉后只返回全部txResult的结果,要实际过滤出来后才能确定有没有跨链tx
if pt.IsParaForkHeight(status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
return true
}
haveCrossTxs := len(status.CrossTxHashs) > 0
if status.Height > 0 && isParaForkHeight(status.MainBlockHeight, pt.ForkCommitTx) && len(status.CrossTxHashs[0]) == 0 {
//ForkCommitTx后,CrossTxHashs[][] 所有跨链交易做成一个校验hash,如果没有则[0]为nil
if status.Height > 0 && pt.IsParaForkHeight(status.MainBlockHeight, pt.ForkCommitTx) && len(status.CrossTxHashs[0]) == 0 {
haveCrossTxs = false
}
return haveCrossTxs
if enableParacrossTransfer && status.Height > 0 && haveCrossTxs {
clog.Debug("paracross.Commit commitDone do cross", "height", status.Height, "havecross", haveCrossTxs)
}
func (a *action) procCrossTxs(status *pt.ParacrossNodeStatus) (*types.Receipt, error) {
if enableParacrossTransfer && status.Height > 0 && isHaveCrossTxs(status) {
clog.Debug("paracross.Commit commitDone do cross", "height", status.Height)
crossTxReceipt, err := a.execCrossTxs(status)
if err != nil {
return nil, err
......@@ -602,9 +581,9 @@ func (a *action) loopCommitTxDone(title string) (*types.Receipt, error) {
return nil, errors.Wrapf(err, "getTitle:%s", title)
}
//当前共识高度还未到分叉高度,则不处理
if !isParaForkHeight(titleStatus.GetMainHeight(), pt.ForkLoopCheckCommitTxDone) {
if !pt.IsParaForkHeight(titleStatus.GetMainHeight(), pt.ForkLoopCheckCommitTxDone) {
return nil, errors.Wrapf(pt.ErrForkHeightNotReach,
"titleHeight:%d,forkHeight:%d", titleStatus.MainHeight, getDappForkHeight(pt.ForkLoopCheckCommitTxDone))
"titleHeight:%d,forkHeight:%d", titleStatus.MainHeight, pt.GetDappForkHeight(pt.ForkLoopCheckCommitTxDone))
}
loopHeight := titleStatus.Height
......@@ -670,18 +649,14 @@ func (a *action) commitTxDoneByStat(stat *pt.ParacrossHeightStatus, titleStatus
r := makeCommitStatReceipt(stat)
receipt = mergeReceipt(receipt, r)
stateHash, txRst, txHash, crossTxRst, crossTxHash := getMostResults([]byte(mostHash), stat)
txRst := getMostResults([]byte(mostHash), stat)
mostStatus := &pt.ParacrossNodeStatus{
MainBlockHash: stat.MainHash,
MainBlockHeight: stat.MainHeight,
Title: stat.Title,
Height: stat.Height,
BlockHash: []byte(mostHash),
StateHash: stateHash,
TxResult: txRst,
TxHashs: [][]byte{txHash},
CrossTxResult: crossTxRst,
CrossTxHashs: [][]byte{crossTxHash},
}
//add commit done receipt
......@@ -707,7 +682,7 @@ func (a *action) isParaSelfConsensSwitch(commit *pt.ParacrossHeightStatus, title
return true, nil
}
selfConsensForkHeight := getDappForkHeight(pt.ParaSelfConsensForkHeight)
selfConsensForkHeight := pt.GetDappForkHeight(pt.ParaSelfConsensForkHeight)
lastStatusMainHeight := int64(-1)
if titleStatus.Height > -1 {
s, err := getTitleHeight(a.db, calcTitleHeightKey(commit.Title, titleStatus.Height))
......@@ -747,8 +722,42 @@ func (a *action) execCrossTx(tx *types.TransactionDetail, crossTxHash []byte) (*
}
func getCrossTxHashsByRst(api client.QueueProtocolAPI, status *pt.ParacrossNodeStatus) ([][]byte, []byte, error) {
//只获取跨链tx
rst, err := hex.DecodeString(string(status.TxResult))
if err != nil {
clog.Error("getCrossTxHashs decode rst", "CrossTxResult", string(status.TxResult), "paraHeight", status.Height)
return nil, nil, types.ErrInvalidParam
}
//空块
if len(rst) == 0 {
return nil, nil, nil
}
blockDetail, err := GetBlock(api, status.MainBlockHash)
if err != nil {
return nil, nil, err
}
//抽取平行链交易和跨链交易
paraAllTxs := FilterTxsForPara(status.Title, blockDetail)
var baseHashs [][]byte
for _, tx := range paraAllTxs {
baseHashs = append(baseHashs, tx.Hash())
}
paraCrossHashs := FilterParaCrossTxHashes(status.Title, paraAllTxs)
crossRst := util.CalcBitMapByBitMap(paraCrossHashs, baseHashs, rst)
return paraCrossHashs, crossRst, nil
}
func getCrossTxHashs(api client.QueueProtocolAPI, status *pt.ParacrossNodeStatus) ([][]byte, []byte, error) {
if !isParaForkHeight(status.MainBlockHeight, pt.ForkCommitTx) {
if pt.IsParaForkHeight(status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
return getCrossTxHashsByRst(api, status)
}
if !pt.IsParaForkHeight(status.MainBlockHeight, pt.ForkCommitTx) {
return status.CrossTxHashs, status.CrossTxResult, nil
}
......@@ -879,7 +888,7 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt,
//当前miner tx不需要校验上一个区块的衔接性,因为tx就是本节点发出,高度,preHash等都在本区块里面的blockchain做了校验
func (a *action) Miner(miner *pt.ParacrossMinerAction) (*types.Receipt, error) {
if miner.Status.Title != types.GetTitle() || miner.Status.PreBlockHash == nil || miner.Status.MainBlockHash == nil {
if miner.Status.Title != types.GetTitle() || miner.Status.MainBlockHash == nil {
return nil, pt.ErrParaMinerExecErr
}
......
......@@ -217,7 +217,6 @@ func setMinerTxResultFork(status *pt.ParacrossNodeStatus, txs []*types.Transacti
}
}
status.TxCounts = uint32(len(curTxHashs))
//有tx且全部是user.p.x.paracross的commit tx时候设为0
status.NonCommitTxCounts = 1
if len(curTxHashs) != 0 && len(curTxHashs) == len(isCommitTx) {
......@@ -227,12 +226,15 @@ func setMinerTxResultFork(status *pt.ParacrossNodeStatus, txs []*types.Transacti
//主链自己过滤平行链tx, 对平行链执行失败的tx主链无法识别,主链和平行链需要获取相同的最初的tx map
//全部平行链tx结果
status.TxResult = []byte(hex.EncodeToString(util.CalcBitMap(curTxHashs, curTxHashs, receipts)))
status.TxResult = []byte(hex.EncodeToString(util.CalcSingleBitMap(curTxHashs, receipts)))
//ForkLoopCheckCommitTxDone 后只保留全部txreseult 结果
if !pt.IsParaForkHeight(status.MainBlockHeight, pt.ForkLoopCheckCommitTxDone) {
//跨链tx结果
status.CrossTxResult = []byte(hex.EncodeToString(util.CalcBitMap(crossTxHashs, curTxHashs, receipts)))
status.TxHashs = [][]byte{CalcTxHashsHash(curTxHashs)}
status.CrossTxHashs = [][]byte{CalcTxHashsHash(crossTxHashs)}
}
return nil
}
......@@ -246,7 +248,7 @@ func (e *Paracross) ExecLocal_Miner(payload *pt.ParacrossMinerAction, tx *types.
var set types.LocalDBSet
txs := e.GetTxs()
forkHeight := getDappForkHeight(pt.ForkCommitTx)
forkHeight := pt.GetDappForkHeight(pt.ForkCommitTx)
//removed the 0 vote tx
if payload.Status.MainBlockHeight >= forkHeight {
......
......@@ -75,7 +75,7 @@ func filterParaTxGroup(title string, tx *types.Transaction, main *types.BlockDet
//FilterTxsForPara include some main tx in tx group before ForkParacrossCommitTx
func FilterTxsForPara(title string, main *types.BlockDetail) []*types.Transaction {
var txs []*types.Transaction
forkHeight := getDappForkHeight(pt.ForkCommitTx)
forkHeight := pt.GetDappForkHeight(pt.ForkCommitTx)
for i := 0; i < len(main.Block.Txs); i++ {
tx := main.Block.Txs[i]
if types.IsSpecificParaExecName(title, string(tx.Execer)) {
......
......@@ -97,9 +97,6 @@ func (c *Paracross) saveLocalParaTxsFork(commitDone *pt.ReceiptParacrossDone, is
Height: commitDone.Height,
BlockHash: commitDone.BlockHash,
TxResult: commitDone.TxResult,
TxHashs: commitDone.TxHashs,
CrossTxResult: commitDone.CrossTxResult,
CrossTxHashs: commitDone.CrossTxHashs,
}
crossTxHashs, crossTxResult, err := getCrossTxHashs(c.GetAPI(), status)
......
......@@ -226,8 +226,6 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) {
MostSameCommit: st.MostSameCommit,
Title: st.Title,
Height: st.Height,
StateHash: common.ToHex(st.StateHash),
TxCounts: st.TxCounts,
TxResult: hex.EncodeToString(st.TxResult),
}
......@@ -313,8 +311,6 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
MostSameCommit: st.MostSameCommit,
Title: st.Title,
Height: st.Height,
StateHash: common.ToHex(st.StateHash),
TxCounts: st.TxCounts,
TxResult: hex.EncodeToString(st.TxResult),
}, nil
}
......
......@@ -612,7 +612,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
}
receipt = mergeReceipt(receipt, r)
if a.exec.GetMainHeight() > getDappForkHeight(pt.ForkLoopCheckCommitTxDone) {
if a.exec.GetMainHeight() > pt.GetDappForkHeight(pt.ForkLoopCheckCommitTxDone) {
//node quit后,如果committx满足2/3目标,自动触发commitDone
r, err = a.loopCommitTxDone(config.Title)
if err != nil {
......
......@@ -16,11 +16,9 @@ message ParacrossStatusDetails {
//记录不同blockHash的详细数据
message ParacrossStatusBlockDetails {
repeated bytes blockHashs = 1;
repeated bytes stateHashs = 2;
repeated bytes txResults = 3;
repeated bytes txHashs = 4;
repeated bytes crossTxResults = 5;
repeated bytes crossTxHashs = 6;
repeated bytes txResults = 2;
}
message ParacrossHeightStatus {
......
......@@ -308,3 +308,38 @@ func (p ParacrossType) CreateRawTransferTx(action string, param json.RawMessage)
return tx, nil
}
func GetDappForkHeight(forkKey string) int64 {
var forkHeight int64
if types.IsPara() {
key := forkKey
switch forkKey {
case ForkCommitTx:
key = MainForkParacrossCommitTx
case ForkLoopCheckCommitTxDone:
key = MainLoopCheckCommitTxDoneForkHeight
}
forkHeight = types.Conf("config.consensus.sub.para").GInt(key)
if forkHeight <= 0 {
forkHeight = types.MaxHeight
}
} else {
forkHeight = types.GetDappFork(ParaX, forkKey)
// CI特殊处理,主链是local,fork都是0,平行链有些配置项需要设置为非0,不然获取到的高度为MaxHeight
if types.IsLocal() {
switch forkKey {
case ForkCommitTx:
forkHeight = 10
case ForkLoopCheckCommitTxDone:
forkHeight = 60
}
}
}
return forkHeight
}
func IsParaForkHeight(height int64, forkKey string) bool {
return height >= GetDappForkHeight(forkKey)
}
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