- If the height is in the first half, start at the genesis block and go up, rather than at the top
- Cache the last lookup and use it as a reference point if it's close to the next request, to make linear lookups always fast
Optimize JSON-RPC getblockhash #1612
pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:opti_getblkhash changing 3 files +21 −4-
luke-jr commented at 8:09 PM on July 19, 2012: member
-
gmaxwell commented at 3:50 AM on July 30, 2012: contributor
Good idea, I've noticed this being slow in some of my tools. Unfortunately, during a reorg I think your cache could end up pointing off into space. It's probably fine to just invalidate the cache every time the chain is updated.
-
1be064190e
Optimize JSON-RPC getblockhash
- If the height is in the first half, start at the genesis block and go up, rather than at the top - Cache the last lookup and use it as a reference point if it's close to the next request, to make linear lookups always fast
-
luke-jr commented at 6:24 PM on August 1, 2012: member
Moved to main.cpp and added code to clear the cache whenever the best block changes.
-
gmaxwell commented at 6:49 PM on August 1, 2012: contributor
Tests out fine for me.
- gmaxwell referenced this in commit 8ce7915aad on Aug 1, 2012
- gmaxwell merged this on Aug 1, 2012
- gmaxwell closed this on Aug 1, 2012
- DrahtBot locked this on Sep 8, 2021