Commit 42c9be94 authored by vipwzw's avatar vipwzw

auto ci

parent e30ad65c
...@@ -353,7 +353,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error ...@@ -353,7 +353,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
// 平行链 (2)commit (5) 将得到一个错误的块 // 平行链 (2)commit (5) 将得到一个错误的块
// 所以有必要做这个检测 // 所以有必要做这个检测
var dbMainHash []byte var dbMainHash []byte
if !types.IsPara(){ if !types.IsPara() {
blockHash, err := getBlockHash(a.api, commit.Status.MainBlockHeight) blockHash, err := getBlockHash(a.api, commit.Status.MainBlockHeight)
if err != nil { if err != nil {
clog.Error("paracross.Commit getBlockHash", "err", err, clog.Error("paracross.Commit getBlockHash", "err", err,
...@@ -362,10 +362,10 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error ...@@ -362,10 +362,10 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
} }
dbMainHash = blockHash.Hash dbMainHash = blockHash.Hash
}else { } else {
block,err := getBlockInfo(a.api,commit.Status.Height) block, err := getBlockInfo(a.api, commit.Status.Height)
if err != nil{ if err != nil {
clog.Error("paracross.Commit getBlockInfo", "err", err,"height", commit.Status.Height, "from", a.fromaddr) clog.Error("paracross.Commit getBlockInfo", "err", err, "height", commit.Status.Height, "from", a.fromaddr)
return nil, err return nil, err
} }
dbMainHash = block.MainHash dbMainHash = block.MainHash
...@@ -527,17 +527,16 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt. ...@@ -527,17 +527,16 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
//平行链自共识校验 //平行链自共识校验
selfBlockHash, err := getBlockHash(a.api, nodeStatus.Height) selfBlockHash, err := getBlockHash(a.api, nodeStatus.Height)
if err != nil { if err != nil {
clog.Error("paracross.CommitDone getBlockHash", "err", err,"commit tx height", nodeStatus.Height, "tx", hex.EncodeToString(a.txhash)) clog.Error("paracross.CommitDone getBlockHash", "err", err, "commit tx height", nodeStatus.Height, "tx", hex.EncodeToString(a.txhash))
return nil, err return nil, err
} }
//说明本节点blockhash和共识hash不一致,需要停止本节点执行 //说明本节点blockhash和共识hash不一致,需要停止本节点执行
if !bytes.Equal(selfBlockHash.Hash,nodeStatus.BlockHash){ if !bytes.Equal(selfBlockHash.Hash, nodeStatus.BlockHash) {
clog.Error("paracross.CommitDone mosthash not match", "height", nodeStatus.Height, clog.Error("paracross.CommitDone mosthash not match", "height", nodeStatus.Height,
"blockHash", hex.EncodeToString(selfBlockHash.Hash),"mosthash",hex.EncodeToString(nodeStatus.BlockHash)) "blockHash", hex.EncodeToString(selfBlockHash.Hash), "mosthash", hex.EncodeToString(nodeStatus.BlockHash))
return nil, pt.ErrParaCurHashNotMatch return nil, pt.ErrParaCurHashNotMatch
} }
//平行连进行奖励分配 //平行连进行奖励分配
rewardReceipt, err := a.reward(nodeStatus, stat) rewardReceipt, err := a.reward(nodeStatus, stat)
//错误会导致和主链处理的共识结果不一致 //错误会导致和主链处理的共识结果不一致
......
...@@ -86,7 +86,7 @@ func getBlockHash(api client.QueueProtocolAPI, height int64) (*types.ReplyHash, ...@@ -86,7 +86,7 @@ func getBlockHash(api client.QueueProtocolAPI, height int64) (*types.ReplyHash,
func getBlockInfo(api client.QueueProtocolAPI, height int64) (*types.Block, error) { func getBlockInfo(api client.QueueProtocolAPI, height int64) (*types.Block, error) {
blockDetails, err := api.GetBlocks(&types.ReqBlocks{Start: height, End: height}) blockDetails, err := api.GetBlocks(&types.ReqBlocks{Start: height, End: height})
if err != nil { if err != nil {
clog.Error("paracross.Commit getBlockInfo","height",height,"err",err.Error()) clog.Error("paracross.Commit getBlockInfo", "height", height, "err", err.Error())
return nil, err return nil, err
} }
if 1 != int64(len(blockDetails.Items)) { if 1 != int64(len(blockDetails.Items)) {
...@@ -96,7 +96,6 @@ func getBlockInfo(api client.QueueProtocolAPI, height int64) (*types.Block, erro ...@@ -96,7 +96,6 @@ func getBlockInfo(api client.QueueProtocolAPI, height int64) (*types.Block, erro
return blockDetails.Items[0].Block, nil return blockDetails.Items[0].Block, nil
} }
func isNotFound(err error) bool { func isNotFound(err error) bool {
if err != nil && (err == dbm.ErrNotFoundInDb || err == types.ErrNotFound) { if err != nil && (err == dbm.ErrNotFoundInDb || err == types.ErrNotFound) {
return true return true
......
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