|
|
@ -2562,7 +2562,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
vector<CInv> vInv; |
|
|
|
vector<CInv> vInv; |
|
|
|
vRecv >> vInv; |
|
|
|
vRecv >> vInv; |
|
|
|
if (vInv.size() > 50000) |
|
|
|
if (vInv.size() > MAX_INV_SZ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pfrom->Misbehaving(20); |
|
|
|
pfrom->Misbehaving(20); |
|
|
|
return error("message inv size() = %d", vInv.size()); |
|
|
|
return error("message inv size() = %d", vInv.size()); |
|
|
@ -2613,7 +2613,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
vector<CInv> vInv; |
|
|
|
vector<CInv> vInv; |
|
|
|
vRecv >> vInv; |
|
|
|
vRecv >> vInv; |
|
|
|
if (vInv.size() > 50000) |
|
|
|
if (vInv.size() > MAX_INV_SZ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pfrom->Misbehaving(20); |
|
|
|
pfrom->Misbehaving(20); |
|
|
|
return error("message getdata size() = %d", vInv.size()); |
|
|
|
return error("message getdata size() = %d", vInv.size()); |
|
|
@ -2655,11 +2655,24 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) |
|
|
|
else if (inv.IsKnownType()) |
|
|
|
else if (inv.IsKnownType()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Send stream from relay memory
|
|
|
|
// Send stream from relay memory
|
|
|
|
|
|
|
|
bool pushed = false; |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_mapRelay); |
|
|
|
LOCK(cs_mapRelay); |
|
|
|
map<CInv, CDataStream>::iterator mi = mapRelay.find(inv); |
|
|
|
map<CInv, CDataStream>::iterator mi = mapRelay.find(inv); |
|
|
|
if (mi != mapRelay.end()) |
|
|
|
if (mi != mapRelay.end()) { |
|
|
|
pfrom->PushMessage(inv.GetCommand(), (*mi).second); |
|
|
|
pfrom->PushMessage(inv.GetCommand(), (*mi).second); |
|
|
|
|
|
|
|
pushed = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!pushed && inv.type == MSG_TX) { |
|
|
|
|
|
|
|
LOCK(mempool.cs); |
|
|
|
|
|
|
|
if (mempool.exists(inv.hash)) { |
|
|
|
|
|
|
|
CTransaction tx = mempool.lookup(inv.hash); |
|
|
|
|
|
|
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
|
|
|
|
ss.reserve(1000); |
|
|
|
|
|
|
|
ss << tx; |
|
|
|
|
|
|
|
pfrom->PushMessage("tx", ss); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2834,6 +2847,22 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (strCommand == "mempool") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
std::vector<uint256> vtxid; |
|
|
|
|
|
|
|
mempool.queryHashes(vtxid); |
|
|
|
|
|
|
|
vector<CInv> vInv; |
|
|
|
|
|
|
|
for (unsigned int i = 0; i < vtxid.size(); i++) { |
|
|
|
|
|
|
|
CInv inv(MSG_TX, vtxid[i]); |
|
|
|
|
|
|
|
vInv.push_back(inv); |
|
|
|
|
|
|
|
if (i == (MAX_INV_SZ - 1)) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (vInv.size() > 0) |
|
|
|
|
|
|
|
pfrom->PushMessage("inv", vInv); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (strCommand == "checkorder") |
|
|
|
else if (strCommand == "checkorder") |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint256 hashReply; |
|
|
|
uint256 hashReply; |
|
|
|