This was a beast of a method, with a lot of duplication and a condition trailing off into infinity. Now you can view it in one glance.
Also, exit once the output is found - no need to continue searching for what
is already found.
This was a beast of a method, with a lot of duplication and a condition trailing off into infinity. Now you can view it in one glance.
Also, exit once the output is found - no need to continue searching for what
is already found.
If you're going to break after the first match you must search backwards (there can be multiple outputs matching the pattern; the last one counts).
Concept NACK. I can understand the desire for easier to read code, but this kind of refactor in consensus logic is generally not worth the review burden.
In this case, exiting early -- a seemingly nice optimization -- would introduce a consensus bug(!).
Thanks guys, TIL. Updated to remove the early exit. Now it's strictly a refactor. Bonus comment to warn future readers.
This was a beast of a method, with a lot of duplication and a condition
trailing off into infinity. Now you can view it in one glance.
Concept ACK
The new code looks a LOT easier to read. Will utACK after double checking it does the same thing (it looks like it does though).
Closing due to NACK and the loads of other code in need of consideration.