diff options
| author | Vasil Dimov <[email protected]> | 2020-05-13 18:45:39 +0200 |
|---|---|---|
| committer | Vasil Dimov <[email protected]> | 2020-07-10 14:58:42 +0200 |
| commit | bc74a40a56128f81f11151d5966f53b82f19038c (patch) | |
| tree | 18d0a729bb932d7806c6ebcd8b743a8429313abb /src/netaddress.h | |
| parent | Merge #19258: doc: improve subtree check instructions (diff) | |
| download | discoin-bc74a40a56128f81f11151d5966f53b82f19038c.tar.xz discoin-bc74a40a56128f81f11151d5966f53b82f19038c.zip | |
net: improve encapsulation of CNetAddr
Do not access `CNetAddr::ip` directly from `CService` methods.
This improvement will help later when we change the type of
`CNetAddr::ip` (in the BIP155 implementation).
Co-authored-by: Carl Dong <[email protected]>
Diffstat (limited to 'src/netaddress.h')
| -rw-r--r-- | src/netaddress.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/netaddress.h b/src/netaddress.h index c20101215..f2daad7fb 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -160,7 +160,11 @@ class CService : public CNetAddr CService(const struct in6_addr& ipv6Addr, uint16_t port); explicit CService(const struct sockaddr_in6& addr); - SERIALIZE_METHODS(CService, obj) { READWRITE(obj.ip, Using<BigEndianFormatter<2>>(obj.port)); } + SERIALIZE_METHODS(CService, obj) + { + READWRITEAS(CNetAddr, obj); + READWRITE(Using<BigEndianFormatter<2>>(obj.port)); + } }; bool SanityCheckASMap(const std::vector<bool>& asmap); |