MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / RespendRelayExceeded

Function RespendRelayExceeded

src/main.cpp:1211–1228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1209}
1210
1211static 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 */
1231std::string FormatStateMessage(const CValidationState &state)

Callers 1

AcceptToMemoryPoolFunction · 0.85

Calls 3

GetArgFunction · 0.85
GetSerializeSizeFunction · 0.85
RateLimitExceededFunction · 0.85

Tested by

no test coverage detected