Fixes/addresses issue #5070. Previous code made two passes through mapBlockIndex, inserted each block into a new set and then erased all but the chain tips - so hundreds of 1000's of inserts/erases. This code makes one pass and only tests orphan blocks for being a chain tip. Speedup on my machine against mainnet about 20x. It passes the getchaintips.py Python test.
Speed up getchaintips. #7827
pull mrbandrews wants to merge 1 commits into bitcoin:master from mrbandrews:ba-fix-chaintips changing 1 files +21 −8-
mrbandrews commented at 7:59 PM on April 6, 2016: contributor
-
instagibbs commented at 8:25 PM on April 6, 2016: member
utACK ac5a245cad5960b1867f586dd32e658b38d1d7f1
-
instagibbs commented at 8:46 PM on April 6, 2016: member
you might want to properly link #5070
- laanwj added the label RPC/REST/ZMQ on Apr 11, 2016
-
sipa commented at 12:17 PM on April 11, 2016: member
utACK ac5a245
-
theuni commented at 5:51 PM on April 12, 2016: member
utACK https://github.com/bitcoin/bitcoin/pull/7827/commits/ac5a245cad5960b1867f586dd32e658b38d1d7f1 .
You could also use
setPrevs.erase(*it) == 0, to reduce the search range as you go. Probably not significant though. -
laanwj commented at 3:47 PM on April 15, 2016: member
@mrbandrews are you planning to add @theuni's suggestion? If so, I'll wait for that, if not, this can be merged.
-
mrbandrews commented at 6:26 PM on April 15, 2016: contributor
Yes I will make that edit but can't do so right now, will do by Monday.
-
Speed up getchaintips. 87049e832d
- mrbandrews force-pushed on Apr 18, 2016
-
mrbandrews commented at 4:17 PM on April 18, 2016: contributor
Force-pushed that edit.
-
laanwj commented at 8:44 AM on April 19, 2016: member
tACK 87049e8 (tested that
getchaintipsreturns the same before and after this patch) - laanwj merged this on Apr 19, 2016
- laanwj closed this on Apr 19, 2016
- laanwj referenced this in commit 4205ad7ca2 on Apr 19, 2016
- codablock referenced this in commit 8bb29886f9 on Sep 16, 2017
- codablock referenced this in commit 9373e11a60 on Sep 19, 2017
- codablock referenced this in commit 4f5bb798e7 on Dec 20, 2017
- MarcoFalke locked this on Sep 8, 2021
Contributors
Labels