Page MenuHomePhabricator

p2p, refactor: make NetPermissionFlags a uint32 enum class
ClosedPublic

Authored by PiRK on Mar 14 2023, 10:24.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC2cf2f8f31a9f: p2p, refactor: make NetPermissionFlags a uint32 enum class
Summary

https://github.com/bitcoin/bitcoin/pull/21506/commits/7b55a9449778c5ac89799ce4c607c8c8d797ddfb

p2p: NetPermissions::HasFlag() pass flags param by value

https://github.com/bitcoin/bitcoin/pull/21506/commits/810d0929c1626bba141af3f779a3c9cd6ece7e75

p2p, refactor: make NetPermissionFlags a uint32 enum class

and define/update operation methods to handle type conversions explicitly. See
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-oper
for more info.

This eliminates the class of bugs like D13323

This concludes backport of core#21506
Depends on D13326

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Mar 14 2023, 10:24
PiRK planned changes to this revision.Mar 14 2023, 10:40

I have to rebase this and move it before the enum renaming in D13324 to allow usage of None and All without shadowing other (non class) enums.

PiRK edited the summary of this revision. (Show Details)

rebase onto D13326 (adding missing scopes)
I moved this before D13324 so that the new enum names won't conflict with other enums

This revision is now accepted and ready to land.Mar 14 2023, 11:15