Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ligaishun
chain33-pai
Commits
e28c26e4
Commit
e28c26e4
authored
Oct 12, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
60740582
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
miner.go
miner/miner.go
+3
-2
pai.go
routers/api/v1/pai.go
+11
-2
No files found.
miner/miner.go
View file @
e28c26e4
...
@@ -70,7 +70,7 @@ func SyncBlock() {
...
@@ -70,7 +70,7 @@ func SyncBlock() {
for
height
:=
processHeight
;
height
<
processHeight
+
maxDownload
;
height
++
{
for
height
:=
processHeight
;
height
<
processHeight
+
maxDownload
;
height
++
{
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
func
(
height
int64
)
{
go
func
(
height
int64
)
{
defer
wg
.
Done
()
//
defer wg.Done()
stat
,
txs
,
err
:=
DealBlock
(
height
)
stat
,
txs
,
err
:=
DealBlock
(
height
)
if
err
!=
nil
{
if
err
!=
nil
{
logging
.
Error
(
"DealBlock err"
,
err
)
logging
.
Error
(
"DealBlock err"
,
err
)
...
@@ -84,6 +84,7 @@ func SyncBlock() {
...
@@ -84,6 +84,7 @@ func SyncBlock() {
logging
.
Info
(
"DealBlock stat"
,
*
stat
)
logging
.
Info
(
"DealBlock stat"
,
*
stat
)
logging
.
Info
(
"DealBlock txs"
,
*
txs
)
logging
.
Info
(
"DealBlock txs"
,
*
txs
)
checkList
[
height
]
=
height
checkList
[
height
]
=
height
wg
.
Done
()
}(
height
)
}(
height
)
}
}
//db.SetMainNetHeight(int(processHeight + types.MaxProcessBlocks + 1))
//db.SetMainNetHeight(int(processHeight + types.MaxProcessBlocks + 1))
...
@@ -140,7 +141,7 @@ func SyncBlock() {
...
@@ -140,7 +141,7 @@ func SyncBlock() {
}
}
panic
(
"exception txs not eq expect"
)
panic
(
"exception txs not eq expect"
)
}
}
err
:=
models
.
UpdateBlocks
(
txsMap
,
statMap
,
processHeight
+
maxDownload
)
err
:=
models
.
UpdateBlocks
(
txsMap
,
statMap
,
processHeight
+
maxDownload
-
1
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
...
...
routers/api/v1/pai.go
View file @
e28c26e4
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"chain33-pai/pkg/e"
"chain33-pai/pkg/e"
"chain33-pai/service/pai_service"
"chain33-pai/service/pai_service"
"chain33-pai/service/stat_service"
"chain33-pai/service/stat_service"
"chain33-pai/pkg/logging"
)
)
...
@@ -37,7 +38,11 @@ func GetTicketInfo(c *gin.Context) {
...
@@ -37,7 +38,11 @@ func GetTicketInfo(c *gin.Context) {
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
var
req
pai_service
.
ReqTicketInfo
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
.
Detail
{
if
req
.
Page
==
0
{
if
req
.
Page
==
0
{
req
.
Page
=
int32
(
1
)
req
.
Page
=
int32
(
1
)
...
@@ -49,6 +54,7 @@ func GetTicketInfo(c *gin.Context) {
...
@@ -49,6 +54,7 @@ func GetTicketInfo(c *gin.Context) {
var
pai
pai_service
.
Pai
var
pai
pai_service
.
Pai
info
,
err
:=
pai
.
GetTicketInfo
(
&
req
)
info
,
err
:=
pai
.
GetTicketInfo
(
&
req
)
if
err
!=
nil
{
if
err
!=
nil
{
logging
.
Error
(
"GetTicketInfo err"
,
err
)
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
}
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
info
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
info
)
...
@@ -58,13 +64,16 @@ func RecordMineTime(c *gin.Context) {
...
@@ -58,13 +64,16 @@ func RecordMineTime(c *gin.Context) {
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
var
req
pai_service
.
ReqMineTime
var
req
pai_service
.
ReqMineTime
err
:=
c
.
BindJSON
(
&
req
)
logging
.
Info
(
"req:"
,
req
)
err
:=
c
.
ShouldBind
(
&
req
)
if
err
!=
nil
{
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
}
}
var
stat
stat_service
.
RaspMinerStat
var
stat
stat_service
.
RaspMinerStat
err
=
stat
.
SetMineTime
(
req
.
Addr
,
req
.
StartTime
,
req
.
EndTime
)
err
=
stat
.
SetMineTime
(
req
.
Addr
,
req
.
StartTime
,
req
.
EndTime
)
if
err
!=
nil
{
if
err
!=
nil
{
logging
.
Error
(
"GetTicketInfo err"
,
err
)
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
}
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
nil
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
nil
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment