Commit efaabcdc authored by suyanlong's avatar suyanlong

fix bug

parent 270e39f3
......@@ -57,7 +57,7 @@ type Paracross struct {
db *util.KVDBList // 记录已完成的hashID、高度等信息。
// 模拟平行链节点
paraHeight *atomic.Uint64 // paraHeightHash = Hash(paraHeight)
paraHeight *atomic.Int64 // paraHeightHash = Hash(paraHeight)
grpcClient types33.Chain33Client
sendMsgCh chan *types33.Transaction // 提交共识交易
privateKey crypto.PrivKey
......@@ -77,7 +77,7 @@ type Paracross struct {
logger hclog.InterceptLogger
}
func (p *Paracross) incParaHeight() uint64 {
func (p *Paracross) incParaHeight() int64 {
h := p.paraHeight.Inc()
value := fmt.Sprintf("%d", h)
_ = p.db.Set([]byte("latest-para-height"), []byte(value))
......@@ -160,7 +160,7 @@ func (p *Paracross) Initialize(configPath string, ID string, extra []byte) error
p.title = chain33Config.Chain33.Title
p.MinTxFeeRate = chain33Config.Chain33.Fee
p.isTest = chain33Config.Chain33.IsTest
p.paraHeight = atomic.NewUint64(0)
p.paraHeight = atomic.NewInt64(-1)
if strings.ToUpper(chain33Config.Chain33.Symbol) == "YCC" {
execAddress, err := address.GetExecAddress(p.title+execer, 2)
if err != nil {
......@@ -398,7 +398,7 @@ func (p *Paracross) processBlock(height, end int64) {
continue END
}
if p.paraHeight.Load() == uint64(status.Height) {
if p.paraHeight.Load() == status.Height {
p.logger.Warn("is syncing block", "status", util.FormatJSON(status), "current main height", height, "para height", status.Height)
time.Sleep(time.Second)
continue END
......@@ -412,7 +412,7 @@ func (p *Paracross) processBlock(height, end int64) {
}
err = p.commitTxStatus(commitStatus, hashData)
if err == nil {
p.paraHeight.Store(uint64(status.Height))
p.paraHeight.Store(status.Height)
}
return err
}
......
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