Commit 34a9a7f9 authored by yukang's avatar yukang Committed by vipwzw

Optimize some code for review

parent 408ddd34
......@@ -187,6 +187,7 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
}
para.blockSyncClient = &BlockSyncClient{
paraClient: para,
notifyChan: make(chan bool),
quitChan: make(chan struct{}),
maxCacheCount: 1000,
......@@ -228,7 +229,8 @@ func (client *client) SetQueueClient(c queue.Client) {
go client.commitMsgClient.handler()
client.wg.Add(1)
go client.CreateBlock()
go client.SyncBlocks()
client.wg.Add(1)
go client.blockSyncClient.SyncBlocks()
}
func (client *client) InitBlock() {
......@@ -257,7 +259,7 @@ func (client *client) InitBlock() {
tx := client.CreateGenesisTx()
newblock.Txs = tx
newblock.TxHash = merkle.CalcMerkleRoot(newblock.Txs)
err := client.CreateGenesisBlock(newblock)
err := client.blockSyncClient.CreateGenesisBlock(newblock)
if err != nil {
panic(fmt.Sprintf("para chain create genesis block,err=%s", err.Error()))
}
......
......@@ -170,8 +170,8 @@ func (client *commitMsgClient) isSync() bool {
return false
}
if !client.paraClient.SyncHasCaughtUp() {
plog.Info("para is not Sync", "syncCaughtUp", client.paraClient.SyncHasCaughtUp())
if !client.paraClient.blockSyncClient.SyncHasCaughtUp() {
plog.Info("para is not Sync", "syncCaughtUp", client.paraClient.blockSyncClient.SyncHasCaughtUp())
return false
}
......
This diff is collapsed.
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