Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
power-node
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
power-node
Commits
295e0c1c
Commit
295e0c1c
authored
Feb 20, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updage commit proof
parent
64f4a42a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
validator.go
validator/validator.go
+9
-6
No files found.
validator/validator.go
View file @
295e0c1c
...
...
@@ -49,12 +49,12 @@ func (p *ProofWorker) ProofStorage() {
proofByte
,
err
:=
json
.
Marshal
(
proof
)
if
err
!=
nil
{
log
.
Error
(
"Failed to marshal proof: "
,
err
)
return
continue
}
err
=
db
.
Put
(
proof
.
TaskId
,
proofByte
)
if
err
!=
nil
{
log
.
Error
(
"leveldb put proof failed: "
,
err
)
return
continue
}
p
.
isCommitProof
[
proof
.
TaskId
]
=
false
}
...
...
@@ -63,15 +63,16 @@ func (p *ProofWorker) ProofStorage() {
}(
p
.
productProofChan
)
timer
:=
time
.
NewTicker
(
time
.
Minute
)
defer
timer
.
Stop
()
randomMinute
:=
getRandInt
()
for
{
select
{
case
<-
timer
.
C
:
min
:=
time
.
Now
()
.
Minute
()
if
min
==
0
{
randomMinute
=
getRandInt
()
}
// 检查是否在指定时间范围内(40-59分钟)
if
min
>=
40
&&
min
<=
59
&&
min
==
randomMinute
{
randomMinute
=
getRandInt
()
proofs
:=
make
([]
*
witnessV1
.
Proof
,
0
)
iter
,
err
:=
db
.
NewIterator
()
if
err
!=
nil
{
...
...
@@ -87,7 +88,7 @@ func (p *ProofWorker) ProofStorage() {
err
:=
json
.
Unmarshal
(
iter
.
Value
(),
proof
)
if
err
!=
nil
{
log
.
Error
(
"Error parsing proof from database: "
,
err
)
return
continue
}
if
p
.
isCommitProof
[
proof
.
TaskId
]
{
continue
...
...
@@ -102,6 +103,7 @@ func (p *ProofWorker) ProofStorage() {
}
if
len
(
proofs
)
>
0
{
p
.
consumeProofChan
<-
proofs
log
.
Info
(
"---------------------------Storage proof data---------------------------"
)
}
}
}
...
...
@@ -121,10 +123,11 @@ func (p *ProofWorker) CommitWitness() {
pushProof
,
err
:=
validatorClient
.
PushProof
(
context
.
Background
(),
proofsReq
,
grpc
.
EmptyCallOption
{})
if
err
!=
nil
{
log
.
Error
(
"Push proof failed :"
,
err
)
return
continue
}
workload
:=
pushProof
.
GetWorkload
()
log
.
Info
(
"Push proof response received : %v"
,
workload
)
log
.
Info
(
"---------------------------Commit witness data---------------------------"
)
}
}
}
...
...
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