Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
8f8ae28f
Commit
8f8ae28f
authored
Jan 18, 2021
by
caopingcp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tendermint wait block
parent
95a394d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
tendermint.go
plugin/consensus/tendermint/tendermint.go
+13
-10
No files found.
plugin/consensus/tendermint/tendermint.go
View file @
8f8ae28f
...
@@ -567,17 +567,20 @@ func (client *Client) CommitBlock(block *types.Block) error {
...
@@ -567,17 +567,20 @@ func (client *Client) CommitBlock(block *types.Block) error {
// WaitBlock by height
// WaitBlock by height
func
(
client
*
Client
)
WaitBlock
(
height
int64
)
bool
{
func
(
client
*
Client
)
WaitBlock
(
height
int64
)
bool
{
retry
:=
0
ticker
:=
time
.
NewTicker
(
10
*
time
.
Second
)
defer
ticker
.
Stop
()
beg
:=
time
.
Now
()
for
{
for
{
newHeight
,
err
:=
client
.
getLastHeight
()
select
{
if
err
==
nil
&&
newHeight
>=
height
{
case
<-
ticker
.
C
:
return
true
tendermintlog
.
Info
(
"Still waiting block......"
,
"height"
,
height
,
"cost"
,
time
.
Since
(
beg
))
}
default
:
retry
++
newHeight
,
err
:=
client
.
getLastHeight
()
time
.
Sleep
(
100
*
time
.
Millisecond
)
if
err
==
nil
&&
newHeight
>=
height
{
if
retry
>=
100
{
return
true
tendermintlog
.
Error
(
"Wait block fail"
,
"height"
,
height
,
"CurrentHeight"
,
newHeight
)
}
return
false
time
.
Sleep
(
100
*
time
.
Millisecond
)
}
}
}
}
}
}
...
...
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