aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-10-25 11:41:22 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2012-10-25 11:41:22 -0700
commit344620e9530dfc359b181c5481b88942448006a8 (patch)
treeadc09a1bfef5a0a8d0338820ab19cfde57f2bca3
parente74d0ab6752407d97c0586b1ba9bbaaad5e2e5f6 (diff)
parent529a4d4824136a00e63cd69831023b9c4dd6936b (diff)
Merge pull request #1904 from laanwj/2012_10_remove_getorder
remove "checkorder" P2P command
-rw-r--r--src/main.cpp48
-rw-r--r--src/main.h1
-rw-r--r--src/net.cpp10
-rw-r--r--src/net.h69
4 files changed, 3 insertions, 125 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 85d3edd551..b1fdc2ed52 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2707,7 +2707,6 @@ unsigned char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
- static map<CService, CPubKey> mapReuseKey;
RandAddSeedPerfmon();
if (fDebug)
printf("received: %s (%"PRIszu" bytes)\n", strCommand.c_str(), vRecv.size());
@@ -3215,53 +3214,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
}
- else if (strCommand == "checkorder")
- {
- uint256 hashReply;
- vRecv >> hashReply;
-
- if (!GetBoolArg("-allowreceivebyip"))
- {
- pfrom->PushMessage("reply", hashReply, (int)2, string(""));
- return true;
- }
-
- CWalletTx order;
- vRecv >> order;
-
- /// we have a chance to check the order here
-
- // Keep giving the same key to the same ip until they use it
- if (!mapReuseKey.count(pfrom->addr))
- pwalletMain->GetKeyFromPool(mapReuseKey[pfrom->addr], true);
-
- // Send back approval of order and pubkey to use
- CScript scriptPubKey;
- scriptPubKey << mapReuseKey[pfrom->addr] << OP_CHECKSIG;
- pfrom->PushMessage("reply", hashReply, (int)0, scriptPubKey);
- }
-
-
- else if (strCommand == "reply")
- {
- uint256 hashReply;
- vRecv >> hashReply;
-
- CRequestTracker tracker;
- {
- LOCK(pfrom->cs_mapRequests);
- map<uint256, CRequestTracker>::iterator mi = pfrom->mapRequests.find(hashReply);
- if (mi != pfrom->mapRequests.end())
- {
- tracker = (*mi).second;
- pfrom->mapRequests.erase(mi);
- }
- }
- if (!tracker.IsNull())
- tracker.fn(tracker.param1, vRecv);
- }
-
-
else if (strCommand == "ping")
{
if (pfrom->nVersion > BIP0031_VERSION)
diff --git a/src/main.h b/src/main.h
index 36869efe63..1751ccc562 100644
--- a/src/main.h
+++ b/src/main.h
@@ -20,7 +20,6 @@ class CReserveKey;
class CAddress;
class CInv;
-class CRequestTracker;
class CNode;
class CBlockIndexWorkComparator;
diff --git a/src/net.cpp b/src/net.cpp
index 2598f0214e..272e6ff0b4 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -710,13 +710,9 @@ void ThreadSocketHandler2(void* parg)
TRY_LOCK(pnode->cs_vRecv, lockRecv);
if (lockRecv)
{
- TRY_LOCK(pnode->cs_mapRequests, lockReq);
- if (lockReq)
- {
- TRY_LOCK(pnode->cs_inventory, lockInv);
- if (lockInv)
- fDelete = true;
- }
+ TRY_LOCK(pnode->cs_inventory, lockInv);
+ if (lockInv)
+ fDelete = true;
}
}
}
diff --git a/src/net.h b/src/net.h
index 5e1564f9ca..57c53035f9 100644
--- a/src/net.h
+++ b/src/net.h
@@ -19,7 +19,6 @@
#include "protocol.h"
#include "addrman.h"
-class CRequestTracker;
class CNode;
class CBlockIndex;
extern int nBestHeight;
@@ -74,25 +73,6 @@ enum
MSG_BLOCK,
};
-class CRequestTracker
-{
-public:
- void (*fn)(void*, CDataStream&);
- void* param1;
-
- explicit CRequestTracker(void (*fnIn)(void*, CDataStream&)=NULL, void* param1In=NULL)
- {
- fn = fnIn;
- param1 = param1In;
- }
-
- bool IsNull()
- {
- return fn == NULL;
- }
-};
-
-
/** Thread types */
enum threadId
{
@@ -189,8 +169,6 @@ protected:
public:
int64 nReleaseTime;
- std::map<uint256, CRequestTracker> mapRequests;
- CCriticalSection cs_mapRequests;
uint256 hashContinue;
CBlockIndex* pindexLastGetBlocksBegin;
uint256 hashLastGetBlocksEnd;
@@ -564,53 +542,6 @@ public:
}
}
-
- void PushRequest(const char* pszCommand,
- void (*fn)(void*, CDataStream&), void* param1)
- {
- uint256 hashReply;
- RAND_bytes((unsigned char*)&hashReply, sizeof(hashReply));
-
- {
- LOCK(cs_mapRequests);
- mapRequests[hashReply] = CRequestTracker(fn, param1);
- }
-
- PushMessage(pszCommand, hashReply);
- }
-
- template<typename T1>
- void PushRequest(const char* pszCommand, const T1& a1,
- void (*fn)(void*, CDataStream&), void* param1)
- {
- uint256 hashReply;
- RAND_bytes((unsigned char*)&hashReply, sizeof(hashReply));
-
- {
- LOCK(cs_mapRequests);
- mapRequests[hashReply] = CRequestTracker(fn, param1);
- }
-
- PushMessage(pszCommand, hashReply, a1);
- }
-
- template<typename T1, typename T2>
- void PushRequest(const char* pszCommand, const T1& a1, const T2& a2,
- void (*fn)(void*, CDataStream&), void* param1)
- {
- uint256 hashReply;
- RAND_bytes((unsigned char*)&hashReply, sizeof(hashReply));
-
- {
- LOCK(cs_mapRequests);
- mapRequests[hashReply] = CRequestTracker(fn, param1);
- }
-
- PushMessage(pszCommand, hashReply, a1, a2);
- }
-
-
-
void PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd);
bool IsSubscribed(unsigned int nChannel);
void Subscribe(unsigned int nChannel, unsigned int nHops=0);