Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
ae6b65ae
Commit
ae6b65ae
authored
6 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
default get_block to strict
parent
182ce782
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/steem/block/stream.py
+1
-1
1 addition, 1 deletion
hive/steem/block/stream.py
hive/steem/client.py
+7
-2
7 additions, 2 deletions
hive/steem/client.py
with
8 additions
and
3 deletions
hive/steem/block/stream.py
+
1
−
1
View file @
ae6b65ae
...
@@ -82,7 +82,7 @@ class BlockStream:
...
@@ -82,7 +82,7 @@ class BlockStream:
while
self
.
_gap_ok
(
curr
,
head
):
while
self
.
_gap_ok
(
curr
,
head
):
head
=
schedule
.
wait_for_block
(
curr
)
head
=
schedule
.
wait_for_block
(
curr
)
block
=
self
.
_client
.
get_block
(
curr
)
block
=
self
.
_client
.
get_block
(
curr
,
strict
=
False
)
schedule
.
check_block
(
curr
,
block
)
schedule
.
check_block
(
curr
,
block
)
if
not
block
:
if
not
block
:
...
...
This diff is collapsed.
Click to expand it.
hive/steem/client.py
+
7
−
2
View file @
ae6b65ae
...
@@ -46,14 +46,19 @@ class SteemClient:
...
@@ -46,14 +46,19 @@ class SteemClient:
assert
'
author
'
in
post
,
"
invalid post: %s
"
%
post
assert
'
author
'
in
post
,
"
invalid post: %s
"
%
post
return
posts
return
posts
def
get_block
(
self
,
num
):
def
get_block
(
self
,
num
,
strict
=
True
):
"""
Fetches a single block.
"""
Fetches a single block.
If the result does not contain a `block` key, it
'
s assumed
If the result does not contain a `block` key, it
'
s assumed
this block does not yet exist and None is returned.
this block does not yet exist and None is returned.
"""
"""
result
=
self
.
__exec
(
'
get_block
'
,
{
'
block_num
'
:
num
})
result
=
self
.
__exec
(
'
get_block
'
,
{
'
block_num
'
:
num
})
return
result
[
'
block
'
]
if
'
block
'
in
result
else
None
if
'
block
'
in
result
:
return
result
[
'
block
'
]
elif
strict
:
raise
Exception
(
'
block %d not available
'
%
num
)
else
:
return
None
def
stream_blocks
(
self
,
start_from
,
trail_blocks
=
0
,
max_gap
=
100
):
def
stream_blocks
(
self
,
start_from
,
trail_blocks
=
0
,
max_gap
=
100
):
"""
Stream blocks. Returns a generator.
"""
"""
Stream blocks. Returns a generator.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment