Fix whitespace in touched files

Leaving the incorrect indentation would be frustrating because:
* Some editor may fix up the whitespace when editing a file, so before
  commiting the whitespace changes need to be undone.
* It makes it harder to use clang-format-diff on a change.

Can be trivially reviewed with --word-diff-regex=. --ignore-all-space
This commit is contained in:
MarcoFalke
2021-07-28 19:54:51 +02:00
parent fa4e6afdae
commit fa1eddb1a3
2 changed files with 518 additions and 521 deletions

View File

@@ -42,8 +42,7 @@ static constexpr int ADDRV2_FORMAT = 0x20000000;
* over all enum values and also `GetExtNetwork()` "extends" this enum by * over all enum values and also `GetExtNetwork()` "extends" this enum by
* introducing standalone constants starting from `NET_MAX`. * introducing standalone constants starting from `NET_MAX`.
*/ */
enum Network enum Network {
{
/// Addresses from these networks are not publicly routable on the global Internet. /// Addresses from these networks are not publicly routable on the global Internet.
NET_UNROUTABLE = 0, NET_UNROUTABLE = 0,
@@ -73,16 +72,14 @@ enum Network
/// Prefix of an IPv6 address when it contains an embedded IPv4 address. /// Prefix of an IPv6 address when it contains an embedded IPv4 address.
/// Used when (un)serializing addresses in ADDRv1 format (pre-BIP155). /// Used when (un)serializing addresses in ADDRv1 format (pre-BIP155).
static const std::array<uint8_t, 12> IPV4_IN_IPV6_PREFIX{ static const std::array<uint8_t, 12> IPV4_IN_IPV6_PREFIX{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF};
};
/// Prefix of an IPv6 address when it contains an embedded TORv2 address. /// Prefix of an IPv6 address when it contains an embedded TORv2 address.
/// Used when (un)serializing addresses in ADDRv1 format (pre-BIP155). /// Used when (un)serializing addresses in ADDRv1 format (pre-BIP155).
/// Such dummy IPv6 addresses are guaranteed to not be publicly routable as they /// Such dummy IPv6 addresses are guaranteed to not be publicly routable as they
/// fall under RFC4193's fc00::/7 subnet allocated to unique-local addresses. /// fall under RFC4193's fc00::/7 subnet allocated to unique-local addresses.
static const std::array<uint8_t, 6> TORV2_IN_IPV6_PREFIX{ static const std::array<uint8_t, 6> TORV2_IN_IPV6_PREFIX{
0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43 0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43};
};
/// Prefix of an IPv6 address when it contains an embedded "internal" address. /// Prefix of an IPv6 address when it contains an embedded "internal" address.
/// Used when (un)serializing addresses in ADDRv1 format (pre-BIP155). /// Used when (un)serializing addresses in ADDRv1 format (pre-BIP155).
@@ -120,7 +117,7 @@ static constexpr uint16_t I2P_SAM31_PORT{0};
*/ */
class CNetAddr class CNetAddr
{ {
protected: protected:
/** /**
* Raw representation of the network address. * Raw representation of the network address.
* In network byte order (big endian) for IPv4 and IPv6. * In network byte order (big endian) for IPv4 and IPv6.
@@ -138,7 +135,7 @@ class CNetAddr
*/ */
uint32_t m_scope_id{0}; uint32_t m_scope_id{0};
public: public:
CNetAddr(); CNetAddr();
explicit CNetAddr(const struct in_addr& ipv4Addr); explicit CNetAddr(const struct in_addr& ipv4Addr);
void SetIP(const CNetAddr& ip); void SetIP(const CNetAddr& ip);
@@ -209,11 +206,11 @@ class CNetAddr
// The AS on the BGP path to the node we use to diversify // The AS on the BGP path to the node we use to diversify
// peers in AddrMan bucketing based on the AS infrastructure. // peers in AddrMan bucketing based on the AS infrastructure.
// The ip->AS mapping depends on how asmap is constructed. // The ip->AS mapping depends on how asmap is constructed.
uint32_t GetMappedAS(const std::vector<bool> &asmap) const; uint32_t GetMappedAS(const std::vector<bool>& asmap) const;
std::vector<unsigned char> GetGroup(const std::vector<bool> &asmap) const; std::vector<unsigned char> GetGroup(const std::vector<bool>& asmap) const;
std::vector<unsigned char> GetAddrBytes() const; std::vector<unsigned char> GetAddrBytes() const;
int GetReachabilityFrom(const CNetAddr *paddrPartner = nullptr) const; int GetReachabilityFrom(const CNetAddr* paddrPartner = nullptr) const;
explicit CNetAddr(const struct in6_addr& pipv6Addr, const uint32_t scope = 0); explicit CNetAddr(const struct in6_addr& pipv6Addr, const uint32_t scope = 0);
bool GetIn6Addr(struct in6_addr* pipv6Addr) const; bool GetIn6Addr(struct in6_addr* pipv6Addr) const;
@@ -259,7 +256,7 @@ class CNetAddr
friend class CNetAddrHash; friend class CNetAddrHash;
friend class CSubNet; friend class CSubNet;
private: private:
/** /**
* Parse a Tor address and set this object to it. * Parse a Tor address and set this object to it.
* @param[in] addr Address to parse, must be a valid C string, for example * @param[in] addr Address to parse, must be a valid C string, for example
@@ -488,7 +485,7 @@ private:
class CSubNet class CSubNet
{ {
protected: protected:
/// Network (base) address /// Network (base) address
CNetAddr network; CNetAddr network;
/// Netmask, in network byte order /// Netmask, in network byte order
@@ -498,7 +495,7 @@ class CSubNet
bool SanityCheck() const; bool SanityCheck() const;
public: public:
/** /**
* Construct an invalid subnet (empty, `Match()` always returns false). * Construct an invalid subnet (empty, `Match()` always returns false).
*/ */
@@ -528,7 +525,7 @@ class CSubNet
*/ */
explicit CSubNet(const CNetAddr& addr); explicit CSubNet(const CNetAddr& addr);
bool Match(const CNetAddr &addr) const; bool Match(const CNetAddr& addr) const;
std::string ToString() const; std::string ToString() const;
bool IsValid() const; bool IsValid() const;
@@ -541,16 +538,16 @@ class CSubNet
/** A combination of a network address (CNetAddr) and a (TCP) port */ /** A combination of a network address (CNetAddr) and a (TCP) port */
class CService : public CNetAddr class CService : public CNetAddr
{ {
protected: protected:
uint16_t port; // host order uint16_t port; // host order
public: public:
CService(); CService();
CService(const CNetAddr& ip, uint16_t port); CService(const CNetAddr& ip, uint16_t port);
CService(const struct in_addr& ipv4Addr, uint16_t port); CService(const struct in_addr& ipv4Addr, uint16_t port);
explicit CService(const struct sockaddr_in& addr); explicit CService(const struct sockaddr_in& addr);
uint16_t GetPort() const; uint16_t GetPort() const;
bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const; bool GetSockAddr(struct sockaddr* paddr, socklen_t* addrlen) const;
bool SetSockAddr(const struct sockaddr* paddr); bool SetSockAddr(const struct sockaddr* paddr);
friend bool operator==(const CService& a, const CService& b); friend bool operator==(const CService& a, const CService& b);
friend bool operator!=(const CService& a, const CService& b) { return !(a == b); } friend bool operator!=(const CService& a, const CService& b) { return !(a == b); }

View File

@@ -310,7 +310,7 @@ FUZZ_TARGET_DESERIALIZE(uint256_deserialize, {
DeserializeFromFuzzingInput(buffer, u256); DeserializeFromFuzzingInput(buffer, u256);
AssertEqualAfterSerializeDeserialize(u256); AssertEqualAfterSerializeDeserialize(u256);
}) })
// Classes intentionally not covered in this file since their deserialization code is // Classes intentionally not covered in this file since their deserialization code is
// fuzzed elsewhere: // fuzzed elsewhere:
// * Deserialization of CTxOut is fuzzed in test/fuzz/tx_out.cpp // * Deserialization of CTxOut is fuzzed in test/fuzz/tx_out.cpp
// * Deserialization of CMutableTransaction is fuzzed in src/test/fuzz/transaction.cpp // * Deserialization of CMutableTransaction is fuzzed in src/test/fuzz/transaction.cpp