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
a63b77e2
Commit
a63b77e2
authored
8 years ago
by
Fabian Schuh
Browse files
Options
Downloads
Patches
Plain Diff
[blockchain] awaitTxConfirmation
parent
2db366bd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bitshares/blockchain.py
+19
-0
19 additions, 0 deletions
bitshares/blockchain.py
with
19 additions
and
0 deletions
bitshares/blockchain.py
+
19
−
0
View file @
a63b77e2
...
@@ -172,3 +172,22 @@ class Blockchain(object):
...
@@ -172,3 +172,22 @@ class Blockchain(object):
:param int block_num: Block number
:param int block_num: Block number
"""
"""
return
int
(
Block
(
block_num
).
time
().
timestamp
())
return
int
(
Block
(
block_num
).
time
().
timestamp
())
def
awaitTxConfirmation
(
self
,
transaction
,
limit
=
50
):
"""
Returns the transction as seen by the blockchain after being included into a block
.. note:: If you want instant confirmation, you need to instanciate
class:`bitshares.blockchain.Blockchain` with
``mode=
"
head
"
``, otherwise, the call will wait until
connfirmed in an irreversible block.
"""
blocknum
=
self
.
get_current_block_num
()
-
2
counter
=
10
for
block
in
self
.
blocks
():
print
(
block
.
get
(
"
block_num
"
))
counter
+=
1
for
tx
in
block
[
"
transactions
"
]:
if
sorted
(
tx
[
"
signatures
"
])
==
sorted
(
transaction
[
"
signatures
"
]):
return
tx
if
counter
>
limit
:
raise
Exception
(
"
The operation has not been added after 10 blocks!
"
)
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