| 4504 | ; |
| 4505 | |
| 4506 | bool static SanityCheckMessage(CNode* peer, const CNetMessage& msg) |
| 4507 | { |
| 4508 | const std::string& strCommand = msg.hdr.GetCommand(); |
| 4509 | uint64_t nMaxMessageSize = NextBlockRaiseCap(GetMaxBlockSize()); |
| 4510 | if (msg.hdr.nMessageSize > nMaxMessageSize || |
| 4511 | (maxMessageSizes.count(strCommand) && msg.hdr.nMessageSize > maxMessageSizes[strCommand])) { |
| 4512 | LogPrint("net", "Oversized %s message from peer=%i (%d bytes)\n", |
| 4513 | SanitizeString(strCommand), peer->GetId(), msg.hdr.nMessageSize); |
| 4514 | Misbehaving(peer->GetId(), 20); |
| 4515 | return msg.hdr.nMessageSize <= nMaxMessageSize; |
| 4516 | } |
| 4517 | // This would be a good place for more sophisticated DoS detection/prevention. |
| 4518 | // (e.g. disconnect a peer that is flooding us with excessive messages) |
| 4519 | |
| 4520 | return true; |
| 4521 | } |
| 4522 | |
| 4523 | |
| 4524 | bool static AlreadyHave(const CInv& inv) |
nothing calls this directly
no test coverage detected