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

Function RateLimitExceeded

src/main.cpp:1196–1209  ·  view source on GitHub ↗

Exponentially limit the rate of nSize flow to nLimit. nLimit unit is thousands-per-minute.

Source from the content-addressed store, hash-verified

1194
1195// Exponentially limit the rate of nSize flow to nLimit. nLimit unit is thousands-per-minute.
1196bool RateLimitExceeded(double& dCount, int64_t& nLastTime, int64_t nLimit, unsigned int nSize)
1197{
1198 static CCriticalSection csLimiter;
1199 int64_t nNow = GetTime();
1200
1201 LOCK(csLimiter);
1202
1203 dCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime));
1204 nLastTime = nNow;
1205 if (dCount >= nLimit*10*1000)
1206 return true;
1207 dCount += nSize;
1208 return false;
1209}
1210
1211static bool RespendRelayExceeded(const CTransaction& doubleSpend)
1212{

Callers 2

RespendRelayExceededFunction · 0.85
AcceptToMemoryPoolFunction · 0.85

Calls 1

GetTimeFunction · 0.85

Tested by

no test coverage detected