fix: Remove unnecessary Truncate
This commit is contained in:
parent
3829d6bd9a
commit
41bce7925a
2
extern/storage-sealing/precommit_policy.go
vendored
2
extern/storage-sealing/precommit_policy.go
vendored
@ -104,7 +104,7 @@ func (p *BasicPreCommitPolicy) getCCSectorLifetime() (abi.ChainEpoch, error) {
|
|||||||
return 0, xerrors.Errorf("sealing config load error: %w", err)
|
return 0, xerrors.Errorf("sealing config load error: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var ccLifetimeEpochs = abi.ChainEpoch(uint64(c.CommittedCapacitySectorLifetime.Truncate(builtin.EpochDurationSeconds).Seconds()) / builtin.EpochDurationSeconds)
|
var ccLifetimeEpochs = abi.ChainEpoch(uint64(c.CommittedCapacitySectorLifetime.Seconds()) / builtin.EpochDurationSeconds)
|
||||||
// if zero value in config, assume maximum sector extension
|
// if zero value in config, assume maximum sector extension
|
||||||
if ccLifetimeEpochs == 0 {
|
if ccLifetimeEpochs == 0 {
|
||||||
ccLifetimeEpochs = policy.GetMaxSectorExpirationExtension()
|
ccLifetimeEpochs = policy.GetMaxSectorExpirationExtension()
|
||||||
|
@ -76,7 +76,7 @@ func TestBasicPolicyEmptySector(t *testing.T) {
|
|||||||
|
|
||||||
func TestCustomCCSectorConfig(t *testing.T) {
|
func TestCustomCCSectorConfig(t *testing.T) {
|
||||||
customLifetime := 200 * 24 * time.Hour
|
customLifetime := 200 * 24 * time.Hour
|
||||||
customLifetimeEpochs := abi.ChainEpoch(int64(customLifetime.Truncate(builtin.EpochDurationSeconds).Seconds()) / builtin.EpochDurationSeconds)
|
customLifetimeEpochs := abi.ChainEpoch(int64(customLifetime.Seconds()) / builtin.EpochDurationSeconds)
|
||||||
cfgStub := fakeConfigStub{CCSectorLifetime: customLifetime}
|
cfgStub := fakeConfigStub{CCSectorLifetime: customLifetime}
|
||||||
cfg := fakeConfigGetter(&cfgStub)
|
cfg := fakeConfigGetter(&cfgStub)
|
||||||
h := abi.ChainEpoch(55)
|
h := abi.ChainEpoch(55)
|
||||||
|
Loading…
Reference in New Issue
Block a user