Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
beem
Commits
a05d81fa
Commit
a05d81fa
authored
5 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
* Fix bug for get_estimated_block_num when a block is missing
parent
5af48705
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
CHANGELOG.rst
+9
-0
9 additions, 0 deletions
CHANGELOG.rst
beem/blockchain.py
+18
-0
18 additions, 0 deletions
beem/blockchain.py
with
27 additions
and
0 deletions
CHANGELOG.rst
+
9
−
0
View file @
a05d81fa
Changelog
Changelog
=========
=========
0.20.22
-------
* Fix #195 - comment.downvote(100) will now downvote with 100%, negative numbers are not allowed anymore
* comment.upvote(), negative numbers are not allowed anymore
* Fix #193 - steem.vote() was added, so that voting is possible without tags_api
* PR #181 - improve permlink derivation by crokkon
* PR #192 - fixes compatibility issues with WhaleShares HF2 / v2.5 by alexpmorris
* Fix bug for get_estimated_block_num when a block is skipped
0.20.21
0.20.21
-------
-------
* Fix float entered in Amount will be reduced by 0.001 due to rounding issues
* Fix float entered in Amount will be reduced by 0.001 due to rounding issues
...
...
This diff is collapsed.
Click to expand it.
beem/blockchain.py
+
18
−
0
View file @
a05d81fa
...
@@ -310,6 +310,16 @@ class Blockchain(object):
...
@@ -310,6 +310,16 @@ class Blockchain(object):
.. note:: The block number returned depends on the ``mode`` used
.. note:: The block number returned depends on the ``mode`` used
when instantiating from this class.
when instantiating from this class.
.. code-block:: python
>>>
from
beem.blockchain
import
Blockchain
>>>
from
datetime
import
datetime
>>>
blockchain
=
Blockchain
()
>>>
block_num
=
blockchain
.
get_estimated_block_num
(
datetime
(
2019
,
6
,
18
,
5
,
8
,
27
))
>>>
block_num
==
33898184
True
"""
"""
last_block
=
self
.
get_current_block
()
last_block
=
self
.
get_current_block
()
date
=
addTzInfo
(
date
)
date
=
addTzInfo
(
date
)
...
@@ -328,9 +338,17 @@ class Blockchain(object):
...
@@ -328,9 +338,17 @@ class Blockchain(object):
if
block_number
>
last_block
.
identifier
:
if
block_number
>
last_block
.
identifier
:
block_number
=
last_block
.
identifier
block_number
=
last_block
.
identifier
block_time_diff
=
timedelta
(
seconds
=
10
)
block_time_diff
=
timedelta
(
seconds
=
10
)
last_block_time_diff_seconds
=
10
second_last_block_time_diff_seconds
=
10
while
block_time_diff
.
total_seconds
()
>
self
.
block_interval
or
block_time_diff
.
total_seconds
()
<
-
self
.
block_interval
:
while
block_time_diff
.
total_seconds
()
>
self
.
block_interval
or
block_time_diff
.
total_seconds
()
<
-
self
.
block_interval
:
block
=
Block
(
block_number
,
steem_instance
=
self
.
steem
)
block
=
Block
(
block_number
,
steem_instance
=
self
.
steem
)
second_last_block_time_diff_seconds
=
last_block_time_diff_seconds
last_block_time_diff_seconds
=
block_time_diff
.
total_seconds
()
block_time_diff
=
date
-
block
.
time
()
block_time_diff
=
date
-
block
.
time
()
if
second_last_block_time_diff_seconds
==
block_time_diff
.
total_seconds
()
and
second_last_block_time_diff_seconds
<
10
:
return
int
(
block_number
)
delta
=
block_time_diff
.
total_seconds
()
//
self
.
block_interval
delta
=
block_time_diff
.
total_seconds
()
//
self
.
block_interval
if
delta
==
0
and
block_time_diff
.
total_seconds
()
<
0
:
if
delta
==
0
and
block_time_diff
.
total_seconds
()
<
0
:
delta
=
-
1
delta
=
-
1
...
...
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