Skip to content
Snippets Groups Projects
Commit 10baa721 authored by inso's avatar inso
Browse files

Check if block doc is correct

parent 752b21b8
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="groupbox_balance">
<property name="title">
<string>Balance</string>
</property>
......
......@@ -163,16 +163,21 @@ class TxHistory():
@asyncio.coroutine
def _parse_block(self, community, block_number, received_list, current_block, txmax):
block = yield from community.bma_access.future_request(qtbma.blockchain.Block,
req_args={'number': block_number})
signed_raw = "{0}{1}\n".format(block['raw'],
block['signature'])
transfers = []
try:
block_doc = Block.from_signed_raw(signed_raw)
except:
logging.debug("Error in {0}".format(block_number))
raise
block = None
tries = 0
while block is None and tries < 3:
block = yield from community.bma_access.future_request(qtbma.blockchain.Block,
req_args={'number': block_number})
signed_raw = "{0}{1}\n".format(block['raw'],
block['signature'])
transfers = []
try:
block_doc = Block.from_signed_raw(signed_raw)
except:
logging.debug("Error in {0}".format(block_number))
block = None
tries += 1
for (txid, tx) in enumerate(block_doc.transactions):
transfer = yield from self._parse_transaction(community, tx, block_number,
block_doc.mediantime, received_list,
......
......@@ -14,6 +14,7 @@ from ..core.registry import Identity
from ..tools.decorators import asyncify, once_at_a_time, cancel_once_task
from .transfer import TransferMoneyDialog
from . import toast
from .busy import Busy
import logging
import asyncio
......@@ -39,6 +40,8 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
self.account = None
self.community = None
self.password_asker = None
self.busy_balance = Busy(self.groupbox_balance)
self.busy_balance.hide()
ts_from = self.date_from.dateTime().toTime_t()
ts_to = self.date_to.dateTime().toTime_t()
......@@ -127,6 +130,7 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
@asyncify
@asyncio.coroutine
def refresh_balance(self):
self.busy_balance.show()
amount = yield from self.app.current_account.amount(self.community)
localized_amount = yield from self.app.current_account.current_ref(amount, self.community,
self.app).localized(units=True,
......@@ -139,6 +143,7 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
localized_amount
)
)
self.busy_balance.hide()
@once_at_a_time
@asyncify
......@@ -294,6 +299,10 @@ QMessageBox.Ok | QMessageBox.Cancel)
self.refresh_balance()
def resizeEvent(self, event):
self.busy_balance.resize(event.size())
super().resizeEvent(event)
def changeEvent(self, event):
"""
Intercepte LanguageChange event to translate UI
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment