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
f6cebec4
Commit
f6cebec4
authored
4 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
Revert changes for Fix corner case last_irreversible_block_num == head_block_number
parent
14a2eb70
No related branches found
No related tags found
2 merge requests
!5
Taken current version of master branch in the https://github.com/holgern/beem
,
!4
Original changes pushed to master at https://github.com/holgern/beem
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beem/transactionbuilder.py
+5
-10
5 additions, 10 deletions
beem/transactionbuilder.py
with
5 additions
and
10 deletions
beem/transactionbuilder.py
+
5
−
10
View file @
f6cebec4
...
@@ -387,7 +387,10 @@ class TransactionBuilder(dict):
...
@@ -387,7 +387,10 @@ class TransactionBuilder(dict):
"""
"""
dynBCParams
=
self
.
blockchain
.
get_dynamic_global_properties
(
use_stored_data
=
False
)
dynBCParams
=
self
.
blockchain
.
get_dynamic_global_properties
(
use_stored_data
=
False
)
if
use_head_block
:
# fix for corner case where last_irreversible_block_num == head_block_number
# then int(dynBCParams["last_irreversible_block_num"]) + 1 does not exists
# and BlockHeader throws error
if
use_head_block
or
int
(
dynBCParams
[
"
last_irreversible_block_num
"
])
==
int
(
dynBCParams
[
"
head_block_number
"
]):
ref_block_num
=
dynBCParams
[
"
head_block_number
"
]
&
0xFFFF
ref_block_num
=
dynBCParams
[
"
head_block_number
"
]
&
0xFFFF
ref_block_prefix
=
struct
.
unpack_from
(
ref_block_prefix
=
struct
.
unpack_from
(
"
<I
"
,
unhexlify
(
dynBCParams
[
"
head_block_id
"
]),
4
"
<I
"
,
unhexlify
(
dynBCParams
[
"
head_block_id
"
]),
4
...
@@ -395,15 +398,7 @@ class TransactionBuilder(dict):
...
@@ -395,15 +398,7 @@ class TransactionBuilder(dict):
else
:
else
:
# need to get subsequent block because block head doesn't return 'id' - stupid
# need to get subsequent block because block head doesn't return 'id' - stupid
from
.block
import
BlockHeader
from
.block
import
BlockHeader
from
.exceptions
import
BlockDoesNotExistsException
block
=
BlockHeader
(
int
(
dynBCParams
[
"
last_irreversible_block_num
"
])
+
1
,
blockchain_instance
=
self
.
blockchain
)
try
:
block
=
BlockHeader
(
int
(
dynBCParams
[
"
last_irreversible_block_num
"
])
+
1
,
blockchain_instance
=
self
.
blockchain
)
except
BlockDoesNotExistsException
:
# fix for corner case where last_irreversible_block_num == head_block_number
# then int(dynBCParams["last_irreversible_block_num"]) + 1 does not exists
# and BlockHeader throws error
time
.
sleep
(
3
)
block
=
BlockHeader
(
int
(
dynBCParams
[
"
last_irreversible_block_num
"
])
+
1
,
blockchain_instance
=
self
.
blockchain
)
ref_block_num
=
dynBCParams
[
"
last_irreversible_block_num
"
]
&
0xFFFF
ref_block_num
=
dynBCParams
[
"
last_irreversible_block_num
"
]
&
0xFFFF
ref_block_prefix
=
struct
.
unpack_from
(
ref_block_prefix
=
struct
.
unpack_from
(
"
<I
"
,
unhexlify
(
block
[
"
previous
"
]),
4
"
<I
"
,
unhexlify
(
block
[
"
previous
"
]),
4
...
...
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