(chopped off from #19031 to ease review)
Before this change, we would analyze the contents of CNetAddr::ip[16]
in order to tell which type is an address. Change this by introducing a
new member CNetAddr::m_net
that explicitly tells the type of the
address.
This is necessary because in BIP155 we will not be able to tell the address type by just looking at its raw representation (e.g. both TORv3 and I2P are “seemingly random” 32 bytes).
As a side effect of this change we no longer need to store IPv4
addresses encoded as IPv6 addresses - we can store them in proper 4
bytes (will be done in a separate commit). Also the code gets
somewhat simplified - instead of
memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0
we can use
m_net == NET_IPV4
.