aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-04-16 14:56:45 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2012-04-17 20:03:42 +0200
commit6b6aaa1698838278a547f16a15e635bd58ec867d (patch)
tree62a79e33a866c2a92f548cecb6148c7339f8beaf /src/net.h
parentccd65d426156c3d5b7a8f1123210decd1f06fe42 (diff)
downloadbitcoin-6b6aaa1698838278a547f16a15e635bd58ec867d.tar.xz
Further reduce header dependencies
This commit removes the dependency of serialize.h on PROTOCOL_VERSION, and makes this parameter required instead of implicit. This is much saner, as it makes the places where changing a version number can have an influence obvious.
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/net.h b/src/net.h
index 95bda9ca69..bad49a9f8f 100644
--- a/src/net.h
+++ b/src/net.h
@@ -157,14 +157,10 @@ public:
CCriticalSection cs_inventory;
std::multimap<int64, CInv> mapAskFor;
- CNode(SOCKET hSocketIn, CAddress addrIn, bool fInboundIn=false)
+ CNode(SOCKET hSocketIn, CAddress addrIn, bool fInboundIn=false) : vSend(SER_NETWORK, MIN_PROTO_VERSION), vRecv(SER_NETWORK, MIN_PROTO_VERSION)
{
nServices = 0;
hSocket = hSocketIn;
- vSend.SetType(SER_NETWORK);
- vRecv.SetType(SER_NETWORK);
- vSend.SetVersion(MIN_PROTO_VERSION);
- vRecv.SetVersion(MIN_PROTO_VERSION);
nLastSend = 0;
nLastRecv = 0;
nLastSendEmpty = GetTime();
@@ -612,7 +608,7 @@ inline void RelayInventory(const CInv& inv)
template<typename T>
void RelayMessage(const CInv& inv, const T& a)
{
- CDataStream ss(SER_NETWORK);
+ CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(10000);
ss << a;
RelayMessage(inv, ss);
@@ -631,7 +627,7 @@ inline void RelayMessage<>(const CInv& inv, const CDataStream& ss)
}
// Save original serialized message so newer versions are preserved
- mapRelay[inv] = ss;
+ mapRelay.insert(std::make_pair(inv, ss));
vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv));
}