miner: remove intermediate conversion to int in tests (#17853)

This fixes the tests on 32bit platforms.
This commit is contained in:
Felix Lange 2018-10-08 16:30:00 +02:00 committed by GitHub
parent cfcc47529d
commit 459278cd57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -390,12 +390,12 @@ func testAdjustInterval(t *testing.T, chainConfig *params.ChainConfig, engine co
case 1: case 1:
origin := float64(3 * time.Second.Nanoseconds()) origin := float64(3 * time.Second.Nanoseconds())
estimate := origin*(1-intervalAdjustRatio) + intervalAdjustRatio*(origin/0.8+intervalAdjustBias) estimate := origin*(1-intervalAdjustRatio) + intervalAdjustRatio*(origin/0.8+intervalAdjustBias)
wantMinInterval, wantRecommitInterval = 3*time.Second, time.Duration(int(estimate))*time.Nanosecond wantMinInterval, wantRecommitInterval = 3*time.Second, time.Duration(estimate)*time.Nanosecond
case 2: case 2:
estimate := result[index-1] estimate := result[index-1]
min := float64(3 * time.Second.Nanoseconds()) min := float64(3 * time.Second.Nanoseconds())
estimate = estimate*(1-intervalAdjustRatio) + intervalAdjustRatio*(min-intervalAdjustBias) estimate = estimate*(1-intervalAdjustRatio) + intervalAdjustRatio*(min-intervalAdjustBias)
wantMinInterval, wantRecommitInterval = 3*time.Second, time.Duration(int(estimate))*time.Nanosecond wantMinInterval, wantRecommitInterval = 3*time.Second, time.Duration(estimate)*time.Nanosecond
case 3: case 3:
wantMinInterval, wantRecommitInterval = time.Second, time.Second wantMinInterval, wantRecommitInterval = time.Second, time.Second
} }