Speed up getchaintips. #7827

pull mrbandrews wants to merge 1 commits into bitcoin:master from mrbandrews:ba-fix-chaintips changing 1 files +21 −8
  1. mrbandrews commented at 7:59 PM on April 6, 2016: contributor

    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.

  2. instagibbs commented at 8:25 PM on April 6, 2016: member

    utACK ac5a245cad5960b1867f586dd32e658b38d1d7f1

  3. instagibbs commented at 8:46 PM on April 6, 2016: member

    you might want to properly link #5070

  4. laanwj added the label RPC/REST/ZMQ on Apr 11, 2016
  5. sipa commented at 12:17 PM on April 11, 2016: member

    utACK ac5a245

  6. 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.

  7. 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.

  8. 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.

  9. Speed up getchaintips. 87049e832d
  10. mrbandrews force-pushed on Apr 18, 2016
  11. mrbandrews commented at 4:17 PM on April 18, 2016: contributor

    Force-pushed that edit.

  12. laanwj commented at 8:44 AM on April 19, 2016: member

    tACK 87049e8 (tested that getchaintips returns the same before and after this patch)

  13. laanwj merged this on Apr 19, 2016
  14. laanwj closed this on Apr 19, 2016

  15. laanwj referenced this in commit 4205ad7ca2 on Apr 19, 2016
  16. codablock referenced this in commit 8bb29886f9 on Sep 16, 2017
  17. codablock referenced this in commit 9373e11a60 on Sep 19, 2017
  18. codablock referenced this in commit 4f5bb798e7 on Dec 20, 2017
  19. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me