Page MenuHomePhabricator

Replace message type literals with protocol.h constants
ClosedPublic

Authored by nakihito on May 20 2020, 22:35.

Details

Summary

No reason to use literals when there exists constant variables that convey the
same information. This reduces the number of places that need to be updated if
a protocol change occurs and makes the code more consistent with the node
software.

sed -i s/\"version\"/NetMsgType::VERSION/g
sed -i s/\"verack\"/NetMsgType::VERACK/g
sed -i s/\"getaddr\"/NetMsgType::GETADDR/g
sed -i s/\"addr\"/NetMsgType::ADDR/g

Test Plan
ninja
ninja check-bitcoin-seeder
cd src/seeder
grep -rnI \"version\"
grep -rnI \"verack\"
grep -rnI \"getaddr\"
grep -rnI \"addr\"

greping for the literals should return nothing in the seeder directory

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

nakihito created this revision.May 20 2020, 22:35
Owners added a reviewer: Restricted Owners Package.May 20 2020, 22:35
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 20 2020, 22:35
nakihito requested review of this revision.May 20 2020, 22:35
deadalnix accepted this revision.May 21 2020, 00:07
This revision is now accepted and ready to land.May 21 2020, 00:07
This revision was automatically updated to reflect the committed changes.