Commit e28c26e4 authored by szh's avatar szh

update

parent 60740582
......@@ -70,7 +70,7 @@ func SyncBlock() {
for height := processHeight ;height < processHeight + maxDownload;height ++ {
wg.Add(1)
go func(height int64) {
defer wg.Done()
//defer wg.Done()
stat,txs,err := DealBlock(height)
if err != nil {
logging.Error("DealBlock err",err)
......@@ -84,6 +84,7 @@ func SyncBlock() {
logging.Info("DealBlock stat",*stat)
logging.Info("DealBlock txs",*txs)
checkList[height] = height
wg.Done()
}(height)
}
//db.SetMainNetHeight(int(processHeight + types.MaxProcessBlocks + 1))
......@@ -140,7 +141,7 @@ func SyncBlock() {
}
panic("exception txs not eq expect")
}
err := models.UpdateBlocks(txsMap,statMap,processHeight+maxDownload)
err := models.UpdateBlocks(txsMap,statMap,processHeight+maxDownload-1)
if err != nil {
panic(err)
}
......
......@@ -7,6 +7,7 @@ import (
"chain33-pai/pkg/e"
"chain33-pai/service/pai_service"
"chain33-pai/service/stat_service"
"chain33-pai/pkg/logging"
)
......@@ -37,7 +38,11 @@ func GetTicketInfo(c *gin.Context) {
appG := app.Gin{C: c}
var req pai_service.ReqTicketInfo
c.BindJSON(&req)
err := c.BindJSON(&req)
if err != nil {
appG.Response(http.StatusOK, e.ERROR, nil)
}
logging.Info("req:",req)
if req.Detail {
if req.Page == 0 {
req.Page = int32(1)
......@@ -49,6 +54,7 @@ func GetTicketInfo(c *gin.Context) {
var pai pai_service.Pai
info,err := pai.GetTicketInfo(&req)
if err != nil {
logging.Error("GetTicketInfo err",err)
appG.Response(http.StatusOK, e.ERROR, nil)
}
appG.Response(http.StatusOK, e.SUCCESS, info)
......@@ -58,13 +64,16 @@ func RecordMineTime(c *gin.Context) {
appG := app.Gin{C: c}
var req pai_service.ReqMineTime
err := c.BindJSON(&req)
logging.Info("req:",req)
err := c.ShouldBind(&req)
if err != nil {
appG.Response(http.StatusOK, e.ERROR, nil)
}
var stat stat_service.RaspMinerStat
err = stat.SetMineTime(req.Addr,req.StartTime,req.EndTime)
if err != nil {
logging.Error("GetTicketInfo err",err)
appG.Response(http.StatusOK, e.ERROR, nil)
}
appG.Response(http.StatusOK, e.SUCCESS, nil)
......
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