| 1209 | } |
| 1210 | |
| 1211 | static bool RespendRelayExceeded(const CTransaction& doubleSpend) |
| 1212 | { |
| 1213 | // Apply an independent rate limit to double-spend relays |
| 1214 | static double dRespendCount; |
| 1215 | static int64_t nLastRespendTime; |
| 1216 | static int64_t nRespendLimit = GetArg("-limitrespendrelay", 100); |
| 1217 | unsigned int nSize = ::GetSerializeSize(doubleSpend, SER_NETWORK, PROTOCOL_VERSION); |
| 1218 | |
| 1219 | if (RateLimitExceeded(dRespendCount, nLastRespendTime, nRespendLimit, nSize)) |
| 1220 | { |
| 1221 | LogPrint("mempool", "Double-spend relay rejected by rate limiter\n"); |
| 1222 | return true; |
| 1223 | } |
| 1224 | |
| 1225 | LogPrint("mempool", "Rate limit dRespendCount: %g => %g\n", dRespendCount, dRespendCount+nSize); |
| 1226 | |
| 1227 | return false; |
| 1228 | } |
| 1229 | |
| 1230 | /** Convert CValidationState to a human-readable message for logging */ |
| 1231 | std::string FormatStateMessage(const CValidationState &state) |
no test coverage detected