feat: reduce wait time when block time already large

This commit is contained in:
Wang Gerui 2024-12-03 23:05:03 +08:00
parent 70a3e886cc
commit 8556473e69

View file

@ -366,9 +366,9 @@ func getResetTime(chain *core.BlockChain, minePeriod int, prevReset0TimeMillisec
if resetTime > minePeriodDuration { if resetTime > minePeriodDuration {
resetTime = minePeriodDuration resetTime = minePeriodDuration
} }
// in case the current block is too far in the past, the block time already is huge, we wait for mine period // in case the current block is too far in the past, the block time already is huge, we wait for 0 time (which will be handled in the next if statement)
if resetTime < 0 { if resetTime < 0 {
resetTime = minePeriodDuration resetTime = 0
} }
if resetTime == 0 { if resetTime == 0 {
if nowTime == *prevReset0TimeMillisec { if nowTime == *prevReset0TimeMillisec {