decred / dcrwallet

A secure Decred wallet daemon written in Go (golang).
https://decred.org
ISC License
216 stars 155 forks source link

wallet: Avoid multiple BlockHash() calculations #2295

Closed matheusd closed 11 months ago

matheusd commented 11 months ago

This PR makes some changes to the wallet, spv syncing and peer packages to avoid having to hash the exact same header multiple times.

This improves both cpu and memory allocation performance during the initial sync process.

On an informal sync on mainnet using spvconnect, this reduces the space allocated by BlockHash() calls by ~60% and the time spent in these functions by ~72%.