You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wallet: Avoid use of Chain::Lock in CWallet::GetKeyBirthTimes
This is a step toward removing the Chain::Lock class and reducing cs_main
locking.
This change only affects behavior in the case where wallet last block processed
falls behind the chain tip, where it will treat the last block processed as the
current tip.
constint max_height = tip_height && *tip_height > 144 ? *tip_height - 144 : 0; // the tip can be reorganized; use a 144-block safety margin
3373
-
std::map<CKeyID, int> mapKeyFirstBlock;
3371
+
constint max_height = m_last_block_processed_height > 144 ? m_last_block_processed_height - 144 : 0; // the tip can be reorganized; use a 144-block safety margin
mapKeyBirth[entry.first] = locked_chain.getBlockTime(entry.second) - TIMESTAMP_WINDOW; // block times can be 2h off
3402
+
for (constauto& entry : mapKeyFirstBlock) {
3403
+
int64_t block_time = 0;
3404
+
mapKeyBirth[entry.first] = !chain().findBlock(entry.second.first, nullptr, &block_time) ? 0 : block_time - TIMESTAMP_WINDOW; // block times can be 2h off
0 commit comments