mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-18 03:27:41 +02:00
Merge #17905: gui: Avoid redundant tx status updates
96cb597325gui: Avoid redundant tx status updates (Russell Yanofsky) Pull request description: This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). In `TransactionTablePriv::index`, avoid calling `interfaces::Wallet::tryGetTxStatus` if the status is up to date as of the most recent `NotifyBlockTip` notification. Store height from the most recent notification in a new `ClientModel::cachedNumBlocks` variable in order to check this. This avoids floods of IPC traffic from `tryGetTxStatus` with #10102 when there are a lot of transactions. It might also make the GUI a little more efficient even when there is no IPC. ACKs for top commit: promag: Code review ACK96cb597325. hebasto: ACK96cb597325Tree-SHA512: fce597bf52a813ad4923110d0a39229ea09e1631e0d580ea18cffb09e58cdbb4b111a40a9a9270ff16d8163cd47b0bd9f1fe7e3a6c7ebb19198f049f8dd1aa46
This commit is contained in:
@@ -105,6 +105,14 @@ int64_t ClientModel::getHeaderTipTime() const
|
||||
return cachedBestHeaderTime;
|
||||
}
|
||||
|
||||
int ClientModel::getNumBlocks() const
|
||||
{
|
||||
if (m_cached_num_blocks == -1) {
|
||||
m_cached_num_blocks = m_node.getNumBlocks();
|
||||
}
|
||||
return m_cached_num_blocks;
|
||||
}
|
||||
|
||||
void ClientModel::updateNumConnections(int numConnections)
|
||||
{
|
||||
Q_EMIT numConnectionsChanged(numConnections);
|
||||
@@ -241,6 +249,8 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int heig
|
||||
// cache best headers time and height to reduce future cs_main locks
|
||||
clientmodel->cachedBestHeaderHeight = height;
|
||||
clientmodel->cachedBestHeaderTime = blockTime;
|
||||
} else {
|
||||
clientmodel->m_cached_num_blocks = height;
|
||||
}
|
||||
|
||||
// During initial sync, block notifications, and header notifications from reindexing are both throttled.
|
||||
|
||||
Reference in New Issue
Block a user