Page MenuHomePhabricator

Refactor IsCompressedOrUncompressedPubKey
ClosedPublic

Authored by deadalnix on Jul 15 2018, 18:29.

Details

Summary

Using a switch is much more readable than a bunch of nested ifs.

Depends on D1568

Test Plan
make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Jul 15 2018, 18:29
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 15 2018, 18:29
kyuupichan requested changes to this revision.Jul 16 2018, 00:09
kyuupichan added a subscriber: kyuupichan.
kyuupichan added inline comments.
src/script/sigencoding.cpp
154 ↗(On Diff #4312)

Even better to collapse the first if in the switch by switching on size instead of the first byte, no?

That gives just 2 entries in the switch other than default, too.

This revision now requires changes to proceed.Jul 16 2018, 00:09
deadalnix updated this revision to Diff 4316.Jul 16 2018, 11:31

Update to switch on size rather than on first byte which simplify the logic.

kyuupichan accepted this revision.Jul 16 2018, 11:35
This revision is now accepted and ready to land.Jul 16 2018, 11:35
This revision was automatically updated to reflect the committed changes.