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
d9256ec7
Commit
d9256ec7
authored
May 29, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix build merkle tree
parent
86f1a4d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
4 deletions
+15
-4
config.toml
config.toml
+2
-2
statedb.go
core/statedb.go
+1
-0
tree.go
core/tree.go
+4
-1
validator.go
core/validator.go
+4
-1
readme.md
readme.md
+4
-0
No files found.
config.toml
View file @
d9256ec7
...
...
@@ -18,7 +18,7 @@ claim-monitor-server = "http://18.167.203.17:28080"
commit-offset
=
3600
# utc + n seconds
quest-host
=
"
43.198.252.255
"
quest-host
=
"
18.167.203.17
"
quest-port
=
8812
...
...
@@ -26,4 +26,4 @@ quest-user = "admin"
quest-pass
=
"quest"
quest-db
=
"qdb"
\ No newline at end of file
quest-db
=
"qdb"
core/statedb.go
View file @
d9256ec7
...
...
@@ -32,6 +32,7 @@ func NewStateDB(lvdb ethdb.KeyValueStore, root common.Hash) (statedb *StateDB, e
func
(
s
*
StateDB
)
GetMinerObject
(
miner
common
.
Address
)
(
object
*
validatorv1
.
MinerObject
)
{
object
=
&
validatorv1
.
MinerObject
{
Miner
:
miner
.
Hex
(),
Balance
:
"0"
,
}
k
:=
crypto
.
Keccak256
(
miner
.
Bytes
())
...
...
core/tree.go
View file @
d9256ec7
...
...
@@ -163,7 +163,10 @@ func (v *Validator) LoadMerkleTree(date string) (ok bool) {
v
.
Lock
()
v
.
mtTreeCache
[
date
]
=
mTree
v
.
Unlock
()
log
.
WithFields
(
log
.
Fields
{
"date"
:
date
,
"root"
:
mTree
.
GetRoot
()
.
Hex
()})
.
Debug
(
"load merkle tree"
)
log
.
WithFields
(
log
.
Fields
{
"date"
:
date
,
"root"
:
mTree
.
GetRoot
()
.
Hex
(),
})
.
Debug
(
"load merkle tree"
)
return
true
}
...
...
core/validator.go
View file @
d9256ec7
...
...
@@ -253,7 +253,10 @@ func (v *Validator) Commit() (dayProofs map[common.Address]*validatorv1.Validate
if
err
!=
nil
{
return
}
log
.
WithFields
(
log
.
Fields
{
"root"
:
root
.
Hex
(),
"cost"
:
time
.
Since
(
st
)
.
String
()})
.
Info
(
"commit state root"
)
log
.
WithFields
(
log
.
Fields
{
"root"
:
root
.
Hex
(),
"cost"
:
time
.
Since
(
st
)
.
String
(),
})
.
Info
(
"commit state root"
)
err
=
v
.
lvdb
.
Put
([]
byte
(
fmt
.
Sprintf
(
"sroot:%s"
,
v
.
date
)),
root
.
Bytes
())
if
err
!=
nil
{
log
.
WithError
(
err
)
.
Error
(
"failed to update state root"
)
...
...
readme.md
View file @
d9256ec7
...
...
@@ -14,6 +14,8 @@ merkle sum tree:
mstv:2020-01-01 -> val1:val2
key = keccak(append(big(workload).Bytes(), address.Bytes())),
merkle tree:
...
...
@@ -21,6 +23,8 @@ merkle tree:
mtk:2020-01-01 -> key1(bytes32)key2(bytes32)
key = keccak(append(common.HexToAddress(Miner).Bytes(), common.LeftPadBytes(balance, 32)...))
state:
lastday -> 2023-01-01
...
...
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