Commit 0f12528b authored by mdj33's avatar mdj33 Committed by vipwzw

fmt

parent 15f0aa0a
...@@ -124,7 +124,7 @@ function start() { ...@@ -124,7 +124,7 @@ function start() {
done done
miner "${CLI}" miner "${CLI}"
# miner "${CLI4}" # miner "${CLI4}"
block_wait "${CLI}" 1 block_wait "${CLI}" 1
echo "=========== check genesis hash ========== " echo "=========== check genesis hash ========== "
...@@ -318,7 +318,7 @@ function transfer() { ...@@ -318,7 +318,7 @@ function transfer() {
function base_config() { function base_config() {
sync sync
transfer "${CLI}" transfer "${CLI}"
# transfer "${CLI4}" # transfer "${CLI4}"
} }
function dapp_run() { function dapp_run() {
......
...@@ -641,7 +641,7 @@ func (client *client) CreateBlock() { ...@@ -641,7 +641,7 @@ func (client *client) CreateBlock() {
} }
plog.Info("Parachain process block", "lastSeq", lastSeq, "curSeq", currSeq, plog.Info("Parachain process block", "lastSeq", lastSeq, "curSeq", currSeq,
"lastBlockHeight",lastBlock.Height,"lastBlockSeq",lastBlockSeq, "lastBlockHeight", lastBlock.Height, "lastBlockSeq", lastBlockSeq,
"currSeqMainHeight", lastSeqMainHeight, "currSeqMainHash", common.ToHex(lastSeqMainHash), "currSeqMainHeight", lastSeqMainHeight, "currSeqMainHash", common.ToHex(lastSeqMainHash),
"lastBlockMainHeight", lastBlock.MainHeight, "lastBlockMainHash", common.ToHex(lastBlock.MainHash), "seqTy", blockOnMain.Seq.Type) "lastBlockMainHeight", lastBlock.MainHeight, "lastBlockMainHash", common.ToHex(lastBlock.MainHash), "seqTy", blockOnMain.Seq.Type)
......
...@@ -34,7 +34,7 @@ type commitMsgClient struct { ...@@ -34,7 +34,7 @@ type commitMsgClient struct {
} }
//获取主链和平行链本身节点的平行链共识状态 //获取主链和平行链本身节点的平行链共识状态
type consensStatus struct{ type consensStatus struct {
mainStatus *pt.ParacrossStatus mainStatus *pt.ParacrossStatus
selfStatus *pt.ParacrossStatus selfStatus *pt.ParacrossStatus
} }
...@@ -111,7 +111,7 @@ out: ...@@ -111,7 +111,7 @@ out:
case <-readTick: case <-readTick:
plog.Debug("para readTick", "notify", notification, "sending", len(sendingMsgs), plog.Debug("para readTick", "notify", notification, "sending", len(sendingMsgs),
"finishHeight", finishHeight, "txIsNil", client.currentTx==nil,"sync",isSync) "finishHeight", finishHeight, "txIsNil", client.currentTx == nil, "sync", isSync)
if notification != nil && finishHeight < notification[1] && client.currentTx == nil && isSync { if notification != nil && finishHeight < notification[1] && client.currentTx == nil && isSync {
count := notification[1] - finishHeight count := notification[1] - finishHeight
...@@ -148,10 +148,10 @@ out: ...@@ -148,10 +148,10 @@ out:
mainConsensHeight := rsp.mainStatus.Height mainConsensHeight := rsp.mainStatus.Height
plog.Info("para consensus rcv", "notify", notification, "sending", len(sendingMsgs), plog.Info("para consensus rcv", "notify", notification, "sending", len(sendingMsgs),
"mainHeigt", rsp.mainStatus.Height, "mainlockhash", common.ToHex(rsp.mainStatus.BlockHash), "mainHeigt", rsp.mainStatus.Height, "mainlockhash", common.ToHex(rsp.mainStatus.BlockHash),
"selfHeight",rsp.selfStatus.Height,"selfHash",common.ToHex(rsp.selfStatus.BlockHash),"sync", isSync) "selfHeight", rsp.selfStatus.Height, "selfHash", common.ToHex(rsp.selfStatus.BlockHash), "sync", isSync)
//所有节点还没有共识场景或新节点或重启节点catchingUp场景,要等到收到区块高度大于主链共识高度时候发送,在catchingup时候本身共识高度和块高度一起增长 //所有节点还没有共识场景或新节点或重启节点catchingUp场景,要等到收到区块高度大于主链共识高度时候发送,在catchingup时候本身共识高度和块高度一起增长
if selfConsensusHeight == -1 || (notification != nil && notification[1] > mainConsensHeight ) { if selfConsensusHeight == -1 || (notification != nil && notification[1] > mainConsensHeight) {
isSync = true isSync = true
} }
...@@ -160,7 +160,6 @@ out: ...@@ -160,7 +160,6 @@ out:
finishHeight = selfConsensusHeight finishHeight = selfConsensusHeight
} }
//系统每次重启都有检查一次共识,如果共识高度落后于系统起来后完成的第一个高度或最小高度,说明可能有共识空洞,需要把从当前共识高度到完成的 //系统每次重启都有检查一次共识,如果共识高度落后于系统起来后完成的第一个高度或最小高度,说明可能有共识空洞,需要把从当前共识高度到完成的
//最大高度重发一遍,直到确认收到,发过的最小到最大高度也要重发是因为之前空洞原因共识不连续,即便满足2/3节点也不会增长,需要重发来触发commit //最大高度重发一遍,直到确认收到,发过的最小到最大高度也要重发是因为之前空洞原因共识不连续,即便满足2/3节点也不会增长,需要重发来触发commit
//此处也整合了当前consensus height=-1 场景 //此处也整合了当前consensus height=-1 场景
...@@ -178,7 +177,7 @@ out: ...@@ -178,7 +177,7 @@ out:
//理论上来说selfConsensusHeight只能小于等于mainConsensusHeihgt,因为在主链先共识之后才会同步到平行链 //理论上来说selfConsensusHeight只能小于等于mainConsensusHeihgt,因为在主链先共识之后才会同步到平行链
//此处主链共识高度应该会开始追赶平行链高度,在这种异常场景下,可能会有重复发送 //此处主链共识高度应该会开始追赶平行链高度,在这种异常场景下,可能会有重复发送
if mainConsensHeight < selfConsensusHeight { if mainConsensHeight < selfConsensusHeight {
plog.Info("para consensus reset","finishHeight",finishHeight,"mainHeight",mainConsensHeight,"selfHeight",selfConsensusHeight) plog.Info("para consensus reset", "finishHeight", finishHeight, "mainHeight", mainConsensHeight, "selfHeight", selfConsensusHeight)
finishHeight = mainConsensHeight finishHeight = mainConsensHeight
sendingMsgs = nil sendingMsgs = nil
client.currentTx = nil client.currentTx = nil
...@@ -494,9 +493,9 @@ out: ...@@ -494,9 +493,9 @@ out:
//从本地查询共识高度 //从本地查询共识高度
ret, err := client.paraClient.GetAPI().QueryChain(&types.ChainExecutor{ ret, err := client.paraClient.GetAPI().QueryChain(&types.ChainExecutor{
Driver:"paracross", Driver: "paracross",
FuncName:"GetTitle", FuncName: "GetTitle",
Param:types.Encode(&types.ReqString{Data: types.GetTitle()}), Param: types.Encode(&types.ReqString{Data: types.GetTitle()}),
}) })
if err != nil { if err != nil {
plog.Error("getConsensusHeight ", "err", err.Error()) plog.Error("getConsensusHeight ", "err", err.Error())
...@@ -510,10 +509,10 @@ out: ...@@ -510,10 +509,10 @@ out:
status.selfStatus = resp status.selfStatus = resp
//获取主链共识高度 //获取主链共识高度
reply, err := client.paraClient.grpcClient.QueryChain(context.Background(),&types.ChainExecutor{ reply, err := client.paraClient.grpcClient.QueryChain(context.Background(), &types.ChainExecutor{
Driver:"paracross", Driver: "paracross",
FuncName:"GetTitle", FuncName: "GetTitle",
Param:types.Encode(&types.ReqString{Data: types.GetTitle()}), Param: types.Encode(&types.ReqString{Data: types.GetTitle()}),
}) })
if err != nil { if err != nil {
plog.Error("getMainConsensusHeight", "err", err.Error()) plog.Error("getMainConsensusHeight", "err", err.Error())
...@@ -525,7 +524,7 @@ out: ...@@ -525,7 +524,7 @@ out:
} }
var result pt.ParacrossStatus var result pt.ParacrossStatus
err = types.Decode(reply.Msg, &result) err = types.Decode(reply.Msg, &result)
if err != nil{ if err != nil {
plog.Error("getMainConsensusHeight decode", "err", err.Error()) plog.Error("getMainConsensusHeight decode", "err", err.Error())
continue continue
} }
......
...@@ -254,7 +254,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error ...@@ -254,7 +254,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
if !bytes.Equal(blockHash.Hash, commit.Status.MainBlockHash) && commit.Status.Height > 0 { if !bytes.Equal(blockHash.Hash, commit.Status.MainBlockHash) && commit.Status.Height > 0 {
clog.Error("paracross.Commit blockHash not match", "db", hex.EncodeToString(blockHash.Hash), clog.Error("paracross.Commit blockHash not match", "db", hex.EncodeToString(blockHash.Hash),
"commit tx", hex.EncodeToString(commit.Status.MainBlockHash), "commitHeight", commit.Status.Height, "commit tx", hex.EncodeToString(commit.Status.MainBlockHash), "commitHeight", commit.Status.Height,
"commitMainHeight",commit.Status.MainBlockHeight,"from", a.fromaddr) "commitMainHeight", commit.Status.MainBlockHeight, "from", a.fromaddr)
return nil, types.ErrBlockHashNoMatch return nil, types.ErrBlockHashNoMatch
} }
} }
......
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