MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / CheckPackBlockTime

Function CheckPackBlockTime

src/miner/miner.cpp:40–51  ·  view source on GitHub ↗

check the time is not exceed the limit time (2s) for packing new block

Source from the content-addressed store, hash-verified

38
39// check the time is not exceed the limit time (2s) for packing new block
40static bool CheckPackBlockTime(int64_t startMiningMs, int32_t blockHeight) {
41 if (g_isMiningTimeLimit) {
42 int64_t nowMs = GetTimeMillis();
43 int64_t limitedTimeMs = std::max(1000LL, (int64_t)GetBlockInterval(blockHeight) * 1000LL - 1000LL);
44 if (nowMs - startMiningMs > limitedTimeMs) {
45 LogPrint(BCLog::MINER, "[%d] pack block time use up! start_ms=%lld, now_ms=%lld, limited_time_ms=%lld\n",
46 blockHeight, startMiningMs, nowMs, limitedTimeMs);
47 return false;
48 }
49 }
50 return true;
51}
52
53// base on the lastest 50 blocks
54uint32_t GetElementForBurn(CBlockIndex *pIndex) {

Callers 2

ProduceBlockFunction · 0.85

Calls 2

GetBlockIntervalFunction · 0.85
GetTimeMillisFunction · 0.50

Tested by

no test coverage detected