Commit bacdcf91 authored by suyanlong's avatar suyanlong

fix bug

parent 4d570a0b
......@@ -355,13 +355,11 @@ func (p *Paracross) processBlock(height, end int64) {
p.logger.Error("processBlock transaction error ", "hash", util.ToHex(tx.Hash()), "txDetail:", util.FormatJSON(txDetail), "height:", height1)
}
}
p.logger.Info("deal height block end-----------------------", "height", height1)
if len(unDoneTx) > 0 {
// 再发起一次确认操作
// 提交模拟status commit事件
END:
for {
commitFun := func() error {
ret, err := p.grpcClient.QueryChain(p.ctx,
&types33.ChainExecutor{
Driver: execer,
......@@ -369,19 +367,24 @@ func (p *Paracross) processBlock(height, end int64) {
Param: types33.Encode(&types33.ReqString{Data: p.title}),
})
if err != nil {
return errors.Wrap(err, "ChainExecutor GetTitle error")
p.logger.Error("ChainExecutor GetTitle error", "error", err)
continue END
}
var status paracorssTypes.ParacrossStatus
err = types33.Decode(ret.Msg, &status)
if err != nil {
return errors.Wrap(err, "ParacrossStatus decode error")
p.logger.Error("ParacrossStatus decode error", "error", err)
continue END
}
if p.paraHeight.Load() == uint64(status.Height) {
p.logger.Warn("is syncing block", "status", util.FormatJSON(status), "current main height", height, "para height", status.Height)
return errors.New("height sync block")
time.Sleep(time.Second)
continue END
}
p.logger.Info("ParacrossStatus", "status", util.FormatJSON(status), "current main height", height)
commitFun := func() error {
commitStatus, err := p.getNodeStatus(unDoneTx, blockDetail, status.Height)
if err != nil {
return errors.Wrap(err, "getNodeStatus error")
......@@ -391,7 +394,6 @@ func (p *Paracross) processBlock(height, end int64) {
p.paraHeight.Store(uint64(status.Height))
}
return err
}
hash := unDoneTx[0]
result, err := p.grpcClient.QueryChain(p.ctx,
......@@ -426,6 +428,7 @@ func (p *Paracross) processBlock(height, end int64) {
}
p.saveBlock(height1, blockDetail)
p.incHeight()
p.logger.Info("deal height block end-----------------------", "height", height1)
}
}
}
......
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