Commit b2b62fd4 authored by mdj33's avatar mdj33 Committed by vipwzw

ajust sending height once wallet open

parent 02189b7a
......@@ -40,6 +40,7 @@ func (client *commitMsgClient) handler() {
var isRollback bool
var notification []int64 //记录每次系统重启后 min and current height
var finishHeight int64
var consensHeight int64
var sendingHeight int64 //当前发送的最大高度
var sendingMsgs []*pt.ParacrossNodeStatus
var readTick <-chan time.Time
......@@ -155,7 +156,7 @@ out:
//获取正在共识的高度,同步有两层意思,一个是主链跟其他节点完成了同步,另一个是当前平行链节点的高度追赶上了共识高度
//一般来说高度增长从小到大: notifiy[0] -- selfConsensusHeight(mainHeight) -- finishHeight -- sendingHeight -- notify[1]
case rsp := <-consensusCh:
consensHeight := rsp.Height
consensHeight = rsp.Height
plog.Info("para consensus rcv", "notify", notification, "sending", len(sendingMsgs),
"consensHeigt", rsp.Height, "finished", finishHeight, "sync", isSync, "miner", readTick != nil, "consensBlockHash", common.ToHex(rsp.BlockHash))
......@@ -193,7 +194,6 @@ out:
finishHeight = consensHeight
sendingMsgs = nil
client.currentTx = nil
isSync = true
}
case miner := <-client.minerSwitch:
......@@ -212,6 +212,9 @@ out:
ticker = time.NewTicker(time.Second * time.Duration(minerInterval))
readTick = ticker.C
plog.Info("para consensus start mining")
//钱包开启后,从共识高度重新开始发送,在需要重发共识时候,不需要重启设备
finishHeight = consensHeight
}
case <-client.quit:
......
......@@ -49,6 +49,9 @@ func (c *Jrpc) GetHeight(req *types.ReqString, result *interface{}) error {
}
data, err := c.cli.GetTitle(context.Background(), req)
if err != nil{
return err
}
*result = *data
return err
......@@ -68,6 +71,9 @@ func (c *channelClient) ListTitles(ctx context.Context, req *types.ReqNil) (*pt.
// ListTitles get paracross consensus titles list
func (c *Jrpc) ListTitles(req *types.ReqNil, result *interface{}) error {
data, err := c.cli.ListTitles(context.Background(), req)
if err != nil{
return err
}
*result = data
return err
}
......@@ -89,6 +95,9 @@ func (c *Jrpc) GetTitleHeight(req *pt.ReqParacrossTitleHeight, result *interface
return types.ErrInvalidParam
}
data, err := c.cli.GetTitleHeight(context.Background(), req)
if err != nil{
return err
}
*result = data
return err
}
......@@ -121,6 +130,9 @@ func (c *Jrpc) GetAssetTxResult(req *types.ReqHash, result *interface{}) error {
return types.ErrInvalidParam
}
data, err := c.cli.GetAssetTxResult(context.Background(), req)
if err != nil{
return err
}
*result = data
return err
}
......@@ -175,8 +187,11 @@ func (c *Jrpc) GetBlock2MainInfo(req *types.ReqBlocks, result *interface{}) erro
}
ret, err := c.cli.GetBlock2MainInfo(context.Background(), req)
if err != nil{
return err
}
*result = *ret
return err
return nil
}
// GetNodeAddrStatus get super node status
......@@ -245,6 +260,9 @@ func (c *channelClient) ListNodeStatus(ctx context.Context, req *pt.ReqParacross
//ListNodeStatus list super node by status
func (c *Jrpc) ListNodeStatus(req *pt.ReqParacrossNodeInfo, result *interface{}) error {
data, err := c.cli.ListNodeStatus(context.Background(), req)
if err != nil{
return err
}
*result = data
return err
}
......@@ -265,6 +283,9 @@ func (c *channelClient) GetNodeGroupAddrs(ctx context.Context, req *pt.ReqParacr
// GetNodeGroupAddrs get super node group addrs
func (c *Jrpc) GetNodeGroupAddrs(req *pt.ReqParacrossNodeInfo, result *interface{}) error {
data, err := c.cli.GetNodeGroupAddrs(context.Background(), req)
if err != nil{
return err
}
*result = data
return err
}
......@@ -285,6 +306,9 @@ func (c *channelClient) GetNodeGroupStatus(ctx context.Context, req *pt.ReqParac
// GetNodeGroupStatus get super node group status
func (c *Jrpc) GetNodeGroupStatus(req *pt.ReqParacrossNodeInfo, result *interface{}) error {
data, err := c.cli.GetNodeGroupStatus(context.Background(), req)
if err != nil{
return err
}
*result = data
return err
}
......@@ -305,6 +329,9 @@ func (c *channelClient) ListNodeGroupStatus(ctx context.Context, req *pt.ReqPara
//ListNodeGroupStatus list super node group by status
func (c *Jrpc) ListNodeGroupStatus(req *pt.ReqParacrossNodeInfo, result *interface{}) error {
data, err := c.cli.ListNodeGroupStatus(context.Background(), req)
if err != nil{
return err
}
*result = data
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