No description provided.
[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-
practicalswift commented at 5:01 PM on January 18, 2017: contributor
- fanquake added the label Wallet on Jan 19, 2017
-
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.
-
paveljanik commented at 7:03 AM on January 19, 2017: contributor
Hmm, what about initializing it with
pindexRescan = chainActive.Genesis();and shorten the code?
-
JeremyRubin commented at 7:15 AM on January 19, 2017: contributor
That seems nice.
- practicalswift force-pushed on Jan 19, 2017
-
practicalswift commented at 8:20 AM on January 19, 2017: contributor
Now initializing to
chainActive.Genesis()as requested :-) -
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)!
- practicalswift force-pushed on Jan 19, 2017
-
practicalswift commented at 11:10 AM on January 19, 2017: contributor
Ah, fixed and pushed! :-)
-
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
-
practicalswift commented at 8:02 PM on January 19, 2017: contributor
@paveljanik Any suggestions on how to explain it succinctly without repeating the code? :-)
-
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.
-
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).
- practicalswift force-pushed on Feb 28, 2017
-
practicalswift commented at 3:51 PM on February 28, 2017: contributor
@laanwj I've now added an explanation in the commit message. Looks good? :-)
-
343ba8fef5
[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.
- practicalswift force-pushed on Feb 28, 2017
-
laanwj commented at 8:21 AM on March 6, 2017: member
@practicalswift yes, awesome.
- laanwj merged this on Mar 6, 2017
- laanwj closed this on Mar 6, 2017
- laanwj referenced this in commit 56ab672b59 on Mar 6, 2017
- PastaPastaPasta referenced this in commit 91d201e799 on Dec 30, 2018
- PastaPastaPasta referenced this in commit 95552dc5de on Dec 31, 2018
- PastaPastaPasta referenced this in commit 8171464cf4 on Dec 31, 2018
- PastaPastaPasta referenced this in commit 800d51cc31 on Dec 31, 2018
- PastaPastaPasta referenced this in commit 5e19098000 on Jan 2, 2019
- PastaPastaPasta referenced this in commit e884534824 on Jan 2, 2019
- PastaPastaPasta referenced this in commit 6b74009f19 on Jan 3, 2019
- PastaPastaPasta referenced this in commit ecc0f98ba9 on Jan 21, 2019
- PastaPastaPasta referenced this in commit 98a9126f87 on Jan 25, 2019
- PastaPastaPasta referenced this in commit 4462424aac on Jan 29, 2019
- PastaPastaPasta referenced this in commit b0e5828898 on Feb 1, 2019
- PastaPastaPasta referenced this in commit 9a7310948c on Feb 1, 2019
- PastaPastaPasta referenced this in commit 4615da99fb on Feb 1, 2019
- practicalswift deleted the branch on Apr 10, 2021
- DrahtBot locked this on Aug 16, 2022