aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/chain.cpp
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-05-26 21:18:46 -0400
committerAndrew Chow <github@achow101.com>2023-05-26 21:35:28 -0400
commit10c4a4613f277687d7580d84b0dd601baab0b7db (patch)
treeaf423a9c3f72c01af58313cbf0de9c62854317e3 /src/kernel/chain.cpp
parent8b59231641845f71df37e163bf5b8157fb197d05 (diff)
parent82bb7831fa6052620998c7eef47e48ed594248a8 (diff)
Merge bitcoin/bitcoin#27469: wallet: improve IBD sync time by skipping block scanning prior birth time
82bb7831fa6052620998c7eef47e48ed594248a8 wallet: skip block scan if block was created before wallet birthday (furszy) a082434d122754ec1a10e0e08a35bdb1f47989e6 refactor: single method to append new spkm to the wallet (furszy) Pull request description: During initial block download, the node's wallet(s) scans every arriving block looking for data that it owns. This process can be resource-intensive, as it involves sequentially scanning all transactions within each arriving block. To avoid wasting processing power, we can skip blocks that occurred before the wallet's creation time, since these blocks are guaranteed not to contain any relevant wallet data. This has direct implications (an speed improvement) on the underlying blockchain synchronization process as well. The reason is that the validation interface queue is limited to 10 tasks per time. This means that no more than 10 blocks can be waiting for the wallet(s) to be processed while we are synchronizing the chain (activating the best chain to be more precise). Which can be a bottleneck if blocks arrive and are processed faster from the network than what they are processed by the wallet(s). So, by skipping not relevant blocks in the wallet's IBD scanning process, we will also improve the chain synchronization time. ACKs for top commit: ishaanam: re-ACK 82bb7831fa6052620998c7eef47e48ed594248a8 achow101: re-ACK 82bb7831fa6052620998c7eef47e48ed594248a8 pinheadmz: ACK 82bb7831fa6052620998c7eef47e48ed594248a8 Tree-SHA512: 70158c9657f1fcc396badad2c4410b7b7f439466142640b31a9b1a8cea4555e45ea254e48043c9b27f783d5e4d24d91855f0d79d42f0484b8aa83cdbf3d6c50b
Diffstat (limited to 'src/kernel/chain.cpp')
-rw-r--r--src/kernel/chain.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/kernel/chain.cpp b/src/kernel/chain.cpp
index 82e77125d7..1c877866d0 100644
--- a/src/kernel/chain.cpp
+++ b/src/kernel/chain.cpp
@@ -16,6 +16,7 @@ interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* index, const CBlock* data
if (index) {
info.prev_hash = index->pprev ? index->pprev->phashBlock : nullptr;
info.height = index->nHeight;
+ info.chain_time_max = index->GetBlockTimeMax();
LOCK(::cs_main);
info.file_number = index->nFile;
info.data_pos = index->nDataPos;