[wallet] Remove redundant initialization #9576

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:remove-redundant-initialization-ii changing 1 files +2 −6
  1. practicalswift commented at 5:01 PM on January 18, 2017: contributor

    No description provided.

  2. fanquake added the label Wallet on Jan 19, 2017
  3. JeremyRubin commented at 4:49 AM on January 19, 2017: contributor

    utACK eb8d6cc.

    nit: I'd like it if you added an assert(pindexRescan != nullptr) after the end of the if/else block, which is the invariant the previous version enforced.

  4. paveljanik commented at 7:03 AM on January 19, 2017: contributor

    Hmm, what about initializing it with

    pindexRescan = chainActive.Genesis();
    

    and shorten the code?

  5. JeremyRubin commented at 7:15 AM on January 19, 2017: contributor

    That seems nice.

  6. practicalswift force-pushed on Jan 19, 2017
  7. practicalswift commented at 8:20 AM on January 19, 2017: contributor

    Now initializing to chainActive.Genesis() as requested :-)

  8. paveljanik commented at 8:23 AM on January 19, 2017: contributor

    You can now remove the else branch (this was the "nice" of the change)!

  9. practicalswift force-pushed on Jan 19, 2017
  10. practicalswift commented at 11:10 AM on January 19, 2017: contributor

    Ah, fixed and pushed! :-)

  11. paveljanik commented at 7:29 PM on January 19, 2017: contributor

    6-,2+ nice. The only missing thing is a comment above the changed code explaining it.

    ACK https://github.com/bitcoin/bitcoin/pull/9576/commits/80fb8e7944a68573336fddb554ac332104336247

  12. practicalswift commented at 8:02 PM on January 19, 2017: contributor

    @paveljanik Any suggestions on how to explain it succinctly without repeating the code? :-)

  13. MarcoFalke commented at 8:05 PM on January 19, 2017: member

    I don't think we need a comment here. This part is rather self explanatory when comparing to other parts of the code base.

  14. laanwj commented at 9:29 AM on January 26, 2017: member

    I'm not missing a comment in the code itself, but an explanation in the commit message as to why this is redundant would be nice (especially for people reading back the commit log).

  15. practicalswift force-pushed on Feb 28, 2017
  16. practicalswift commented at 3:51 PM on February 28, 2017: contributor

    @laanwj I've now added an explanation in the commit message. Looks good? :-)

  17. [wallet] Remove redundant initialization
    Prior to this commit pindexRescan was initialized to a chainActive.Tip().
    However, the value of pindexRescan set at time of initialization was never
    read before pindexRescan was being set to either chainActive.Genesis()
    (case 1), FindForkInGlobalIndex(chainActive, locator) (case 2) or
    chainActive.Genesis() (case 3). Thus, the initialization was redundant.
    
    This commit a.) removes the redundant initialization and b.) simplifies
    this logic so that pindexRescan is initialized to chainActive.Genesis()
    (case 1 and 3), and set to FindForkInGlobalIndex(chainActive, locator)
    (case 2) as needed.
    343ba8fef5
  18. practicalswift force-pushed on Feb 28, 2017
  19. laanwj commented at 8:21 AM on March 6, 2017: member

    @practicalswift yes, awesome.

  20. laanwj merged this on Mar 6, 2017
  21. laanwj closed this on Mar 6, 2017

  22. laanwj referenced this in commit 56ab672b59 on Mar 6, 2017
  23. PastaPastaPasta referenced this in commit 91d201e799 on Dec 30, 2018
  24. PastaPastaPasta referenced this in commit 95552dc5de on Dec 31, 2018
  25. PastaPastaPasta referenced this in commit 8171464cf4 on Dec 31, 2018
  26. PastaPastaPasta referenced this in commit 800d51cc31 on Dec 31, 2018
  27. PastaPastaPasta referenced this in commit 5e19098000 on Jan 2, 2019
  28. PastaPastaPasta referenced this in commit e884534824 on Jan 2, 2019
  29. PastaPastaPasta referenced this in commit 6b74009f19 on Jan 3, 2019
  30. PastaPastaPasta referenced this in commit ecc0f98ba9 on Jan 21, 2019
  31. PastaPastaPasta referenced this in commit 98a9126f87 on Jan 25, 2019
  32. PastaPastaPasta referenced this in commit 4462424aac on Jan 29, 2019
  33. PastaPastaPasta referenced this in commit b0e5828898 on Feb 1, 2019
  34. PastaPastaPasta referenced this in commit 9a7310948c on Feb 1, 2019
  35. PastaPastaPasta referenced this in commit 4615da99fb on Feb 1, 2019
  36. practicalswift deleted the branch on Apr 10, 2021
  37. DrahtBot locked this on Aug 16, 2022

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-16 15:15 UTC

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