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
c4833a46
Commit
c4833a46
authored
Nov 04, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
f486ec1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
16 deletions
+7
-16
main.go
cmd/parser/main.go
+4
-0
miner.go
miner/miner.go
+3
-16
No files found.
cmd/parser/main.go
View file @
c4833a46
...
...
@@ -9,6 +9,7 @@ import (
"chain33-pai/pkg/util"
"chain33-pai/miner"
"chain33-pai/pkg/chain33"
"net/http"
)
func
init
()
{
...
...
@@ -29,6 +30,9 @@ func init() {
// @license.url https://chain33-pai/blob/master/LICENSE
func
main
()
{
gin
.
SetMode
(
setting
.
ServerSetting
.
RunMode
)
go
func
()
{
http
.
ListenAndServe
(
"0.0.0.0:6061"
,
nil
)
}()
go
miner
.
SyncBlock
()
select
{}
}
miner/miner.go
View file @
c4833a46
...
...
@@ -71,6 +71,7 @@ func SyncBlock() {
checkList
:=
make
(
map
[
int64
]
int64
,
0
)
var
wg
sync
.
WaitGroup
var
mutx
sync
.
Mutex
logging
.
Info
(
"start startHeight:"
,
processHeight
,
" endHeight:"
,
processHeight
+
maxDownload
-
1
)
for
height
:=
processHeight
;
height
<
processHeight
+
maxDownload
;
height
++
{
wg
.
Add
(
1
)
go
func
(
height
int64
)
{
...
...
@@ -140,7 +141,7 @@ func SyncBlock() {
panic
(
err
)
}
prev
.
LocalHeight
+=
maxDownload
logging
.
Info
(
"startHeight:"
,
processHeight
,
" endHeight:"
,
processHeight
+
maxDownload
-
1
)
logging
.
Info
(
"
end
startHeight:"
,
processHeight
,
" endHeight:"
,
processHeight
+
maxDownload
-
1
)
}
...
...
@@ -187,6 +188,7 @@ func DealBlock(height int64) ( []*models.RaspMinerStat, *models.RaspMinerTxs,er
}
if
rt1
!=
nil
&&
rt1
.
Miner
!=
""
{
rt
.
Miner
=
rt1
.
Miner
rt
.
ReturnAddr
=
rt1
.
ReturnAddr
rt
.
Amount
=
rt1
.
Amount
rt
.
Hash
=
rt1
.
Hash
}
...
...
@@ -218,16 +220,6 @@ func DealBlock(height int64) ( []*models.RaspMinerStat, *models.RaspMinerTxs,er
rt
.
Height
=
block
.
Block
.
Height
rt
.
Time
=
block
.
Block
.
BlockTime
//处理交易日志
//for _,v := range block.Receipts {
// if v.Ty == types.ExecOk {
// logs := v.GetLogs()
// for _, vv := range logs {
//
// }
// }
//
//}
raspStatList
:=
make
([]
*
models
.
RaspMinerStat
,
0
)
for
_
,
v
:=
range
rsMap
{
raspStat
:=
NewMinerStat
(
v
)
...
...
@@ -238,11 +230,6 @@ func DealBlock(height int64) ( []*models.RaspMinerStat, *models.RaspMinerTxs,er
raspTxs
:=
NewMinerTxs
(
rt
)
logging
.
Info
(
"txs"
,
*
raspTxs
)
//err = models.UpdateBlock(raspTxs,raspStat)
//if err != nil {
// logging.Error("UpdateBlock err ",err)
// return err
//}
return
raspStatList
,
raspTxs
,
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