qt: Move transaction notification to transaction table model

Move transaction new/update notification to TransactionTableModel.
This moves the concerns to where they're actually handled.
No need to bounce this through wallet model.

- Do wallet transaction preprocessing on signal handler side;
  avoids locking cs_main/cs_wallet on notification in GUI thread
  (except for new transactions)
This commit is contained in:
Wladimir J. van der Laan
2014-10-28 19:52:21 +01:00
parent cd9114e513
commit 023e63df78
5 changed files with 160 additions and 111 deletions

View File

@@ -137,10 +137,12 @@ void WalletView::setWalletModel(WalletModel *walletModel)
void WalletView::processNewTransaction(const QModelIndex& parent, int start, int /*end*/)
{
// Prevent balloon-spam when initial block download is in progress
if (!walletModel || walletModel->processingQueuedTransactions() || !clientModel || clientModel->inInitialBlockDownload())
if (!walletModel || !clientModel || clientModel->inInitialBlockDownload())
return;
TransactionTableModel *ttm = walletModel->getTransactionTableModel();
if (!ttm || ttm->processingQueuedTransactions())
return;
QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong();