From aac320537523f1df1523adeba22a8498884715c9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 18 Dec 2014 22:07:31 +0100 Subject: src/netbase.h: Fix endian in CNetAddr serialization We've chosen to htons/ntohs explicitly on reading and writing (I do not know why). But as READWRITE already does an endian swap on big endian, this means the port number gets switched around, which was what we were trying to avoid in the first place. So to make this compatible, serialize it as FLATDATA. --- src/netbase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/netbase.h') diff --git a/src/netbase.h b/src/netbase.h index 5bf13a673f..b42c2dffa4 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -162,7 +162,7 @@ class CService : public CNetAddr inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(FLATDATA(ip)); unsigned short portN = htons(port); - READWRITE(portN); + READWRITE(FLATDATA(portN)); if (ser_action.ForRead()) port = ntohs(portN); } -- cgit v1.2.3