Added best block hash to the NotifyHeaderTip and NotifyBlockTip signals.

[ClientModel] best header/block hash cached.
This commit is contained in:
furszy
2020-01-23 19:31:16 -03:00
parent cfe22a5f9e
commit 2f867203b0
11 changed files with 57 additions and 34 deletions

View File

@@ -176,7 +176,7 @@ public:
return cachedWallet.size();
}
TransactionRecord *index(interfaces::Wallet& wallet, const int cur_num_blocks, const int idx)
TransactionRecord* index(interfaces::Wallet& wallet, const uint256& cur_block_hash, const int idx)
{
if(idx >= 0 && idx < cachedWallet.size())
{
@@ -192,8 +192,8 @@ public:
interfaces::WalletTxStatus wtx;
int numBlocks;
int64_t block_time;
if (rec->statusUpdateNeeded(cur_num_blocks) && wallet.tryGetTxStatus(rec->hash, wtx, numBlocks, block_time)) {
rec->updateStatus(wtx, numBlocks, block_time);
if (rec->statusUpdateNeeded(cur_block_hash) && wallet.tryGetTxStatus(rec->hash, wtx, numBlocks, block_time)) {
rec->updateStatus(wtx, cur_block_hash, numBlocks, block_time);
}
return rec;
}
@@ -664,7 +664,7 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex &parent) const
{
Q_UNUSED(parent);
TransactionRecord *data = priv->index(walletModel->wallet(), walletModel->getNumBlocks(), row);
TransactionRecord* data = priv->index(walletModel->wallet(), walletModel->clientModel().getBestBlockHash(), row);
if(data)
{
return createIndex(row, column, data);