Created
June 23, 2020 11:00
-
-
Save xeroc/62fed997b7f90f392709eb943e34e4c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not self.worker.blockchain.nobroadcast: | |
# We using blocking so after this call we can be sure the operation | |
# is on the blockchain. However, a transfer does not return a | |
# resulting operation id as no object is created, thus we go thru | |
# the history and obtain the most recent operation id | |
# FIXME: potentially, this could go wrong in case some other entity | |
# has access ot the accounting account too and leverages that at the | |
# very same time. The ids would still be close to each other | |
account = Account(self.accounting_account) | |
statistics = Object(account["statistics"]) | |
most_recent_op = Object(statistics["most_recent_op"]) | |
op_id = most_recent_op["operation_id"] | |
log.info("operation ID: {}".format(op_id)) | |
# Store transaction | |
bill.operation_id = op_id | |
db.session.commit() | |
db.session.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment