check the time is not exceed the limit time (2s) for packing new block
| 38 | |
| 39 | // check the time is not exceed the limit time (2s) for packing new block |
| 40 | static 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 |
| 54 | uint32_t GetElementForBurn(CBlockIndex *pIndex) { |
no test coverage detected