aboutsummaryrefslogtreecommitdiff
path: root/src/net_permissions.h
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-03-21 22:46:50 +0100
committerJon Atack <jon@atack.com>2021-05-12 16:13:30 +0200
commita95540cf435029f06e56749802d71315ca76b0dd (patch)
tree98477de463757ddd35d1238778bcd4c916126eaa /src/net_permissions.h
parent810d0929c1626bba141af3f779a3c9cd6ece7e75 (diff)
downloadbitcoin-a95540cf435029f06e56749802d71315ca76b0dd.tar.xz
scripted-diff: rename NetPermissionFlags enumerators
- drop redundant PF_ permission flags prefixes - drop ALL_CAPS naming per https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps - rename IsImplicit to Implicit -BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } s 'PF_NONE' 'None' s 'PF_BLOOMFILTER' 'BloomFilter' s 'PF_RELAY' 'Relay' s 'PF_FORCERELAY' 'ForceRelay' s 'PF_DOWNLOAD' 'Download' s 'PF_NOBAN' 'NoBan' s 'PF_MEMPOOL' 'Mempool' s 'PF_ADDR' 'Addr' s 'PF_ISIMPLICIT' 'Implicit' s 'PF_ALL' 'All' -END VERIFY SCRIPT-
Diffstat (limited to 'src/net_permissions.h')
-rw-r--r--src/net_permissions.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/net_permissions.h b/src/net_permissions.h
index 55b6db58da..7a158aa6c5 100644
--- a/src/net_permissions.h
+++ b/src/net_permissions.h
@@ -16,27 +16,27 @@ struct bilingual_str;
extern const std::vector<std::string> NET_PERMISSIONS_DOC;
enum class NetPermissionFlags : uint32_t {
- PF_NONE = 0,
+ None = 0,
// Can query bloomfilter even if -peerbloomfilters is false
- PF_BLOOMFILTER = (1U << 1),
+ BloomFilter = (1U << 1),
// Relay and accept transactions from this peer, even if -blocksonly is true
// This peer is also not subject to limits on how many transaction INVs are tracked
- PF_RELAY = (1U << 3),
+ Relay = (1U << 3),
// Always relay transactions from this peer, even if already in mempool
// Keep parameter interaction: forcerelay implies relay
- PF_FORCERELAY = (1U << 2) | PF_RELAY,
+ ForceRelay = (1U << 2) | Relay,
// Allow getheaders during IBD and block-download after maxuploadtarget limit
- PF_DOWNLOAD = (1U << 6),
+ Download = (1U << 6),
// Can't be banned/disconnected/discouraged for misbehavior
- PF_NOBAN = (1U << 4) | PF_DOWNLOAD,
+ NoBan = (1U << 4) | Download,
// Can query the mempool
- PF_MEMPOOL = (1U << 5),
+ Mempool = (1U << 5),
// Can request addrs without hitting a privacy-preserving cache
- PF_ADDR = (1U << 7),
+ Addr = (1U << 7),
// True if the user did not specifically set fine grained permissions
- PF_ISIMPLICIT = (1U << 31),
- PF_ALL = PF_BLOOMFILTER | PF_FORCERELAY | PF_RELAY | PF_NOBAN | PF_MEMPOOL | PF_DOWNLOAD | PF_ADDR,
+ Implicit = (1U << 31),
+ All = BloomFilter | ForceRelay | Relay | NoBan | Mempool | Download | Addr,
};
static inline constexpr NetPermissionFlags operator|(NetPermissionFlags a, NetPermissionFlags b)
{
@@ -58,14 +58,14 @@ public:
{
flags = flags | f;
}
- //! ClearFlag is only called with `f` == NetPermissionFlags::PF_ISIMPLICIT.
+ //! ClearFlag is only called with `f` == NetPermissionFlags::Implicit.
//! If that should change in the future, be aware that ClearFlag should not
- //! be called with a subflag of a multiflag, e.g. NetPermissionFlags::PF_RELAY
- //! or NetPermissionFlags::PF_DOWNLOAD, as that would leave `flags` in an
+ //! be called with a subflag of a multiflag, e.g. NetPermissionFlags::Relay
+ //! or NetPermissionFlags::Download, as that would leave `flags` in an
//! invalid state corresponding to none of the existing flags.
static inline void ClearFlag(NetPermissionFlags& flags, NetPermissionFlags f)
{
- assert(f == NetPermissionFlags::PF_ISIMPLICIT);
+ assert(f == NetPermissionFlags::Implicit);
using t = typename std::underlying_type<NetPermissionFlags>::type;
flags = static_cast<NetPermissionFlags>(static_cast<t>(flags) & ~static_cast<t>(f));
}