Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
validator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
validator
Commits
e52d8129
Commit
e52d8129
authored
May 10, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix api
parent
6a9815bd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
api.go
api/api.go
+1
-0
chain.go
core/chain.go
+5
-2
interface.go
core/interface.go
+4
-1
No files found.
api/
rpc
.go
→
api/
api
.go
View file @
e52d8129
...
...
@@ -46,6 +46,7 @@ func getWorkload(c *gin.Context) {
if
err
!=
nil
{
log
.
WithError
(
err
)
.
Error
(
"failed to get workload"
)
c
.
JSON
(
200
,
withError
(
InternalError
))
return
}
c
.
JSON
(
200
,
withSuccess
(
ret
))
...
...
core/chain.go
View file @
e52d8129
...
...
@@ -92,8 +92,11 @@ func (r *ChainRPC) GetWeiPerWorkload(timestamp uint64) (reward, workload, weiPer
}
if
big
.
NewInt
(
0
)
.
Cmp
(
workloadDay
)
==
0
||
big
.
NewInt
(
0
)
.
Cmp
(
rewardDay
)
==
0
{
err
=
errors
.
New
(
"workload or reward is zero"
)
return
log
.
WithFields
(
log
.
Fields
{
"workloadDay"
:
workloadDay
.
String
(),
"rewardDay"
:
rewardDay
.
String
(),
})
.
Warn
(
"get wei per workload empty"
)
return
big
.
NewInt
(
0
),
big
.
NewInt
(
0
),
big
.
NewInt
(
0
),
nil
}
return
rewardDay
,
workloadDay
,
big
.
NewInt
(
0
)
.
Quo
(
rewardDay
,
workloadDay
),
nil
}
...
...
core/interface.go
View file @
e52d8129
...
...
@@ -163,6 +163,9 @@ func (v *Validator) GetReward(address common.Address) (reward *big.Int) {
if
object
==
nil
{
return
big
.
NewInt
(
0
)
}
b
,
_
:=
big
.
NewInt
(
0
)
.
SetString
(
object
.
Balance
,
10
)
b
,
ok
:=
big
.
NewInt
(
0
)
.
SetString
(
object
.
Balance
,
10
)
if
!
ok
{
return
big
.
NewInt
(
0
)
}
return
b
}
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