diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-04-14 16:04:50 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-04-14 16:24:56 +0200 |
commit | 38c310299cfef419d42744362b90c1700b598953 (patch) | |
tree | 19e64456f05f18420a322611f772e4b73807846c /src/net.cpp | |
parent | 97d0b9889f151449656d6b575f4f864df0f91a80 (diff) |
Change mapRelay to store CTransactions
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/net.cpp b/src/net.cpp index 3bf8c165dc..e64cb4ef90 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -90,8 +90,8 @@ std::string strSubVersion; vector<CNode*> vNodes; CCriticalSection cs_vNodes; -map<CInv, CDataStream> mapRelay; -deque<pair<int64_t, CInv> > vRelayExpiration; +map<uint256, CTransaction> mapRelay; +deque<pair<int64_t, uint256> > vRelayExpiration; CCriticalSection cs_mapRelay; limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ); @@ -2055,14 +2055,6 @@ instance_of_cnetcleanup; void RelayTransaction(const CTransaction& tx, CFeeRate feerate) { - CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); - ss.reserve(10000); - ss << tx; - RelayTransaction(tx, feerate, ss); -} - -void RelayTransaction(const CTransaction& tx, CFeeRate feerate, const CDataStream& ss) -{ CInv inv(MSG_TX, tx.GetHash()); { LOCK(cs_mapRelay); @@ -2073,9 +2065,8 @@ void RelayTransaction(const CTransaction& tx, CFeeRate feerate, const CDataStrea vRelayExpiration.pop_front(); } - // Save original serialized message so newer versions are preserved - mapRelay.insert(std::make_pair(inv, ss)); - vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv)); + mapRelay.insert(std::make_pair(inv.hash, tx)); + vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv.hash)); } LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) |