Commit 7e8cd370 authored by Christopher Schinnerl's avatar Christopher Schinnerl

fixing more tests

parent a2b46d1a
......@@ -493,7 +493,6 @@ func (r *Renter) managedRenterContractsAndUtilities(entrys []*siafile.SiaFileSet
r.log.Debugln("WARN: Could not update used hosts:", err)
}
}
// Build 2 maps that map every pubkey to its offline and goodForRenew
// status.
contracts = make(map[string]modules.RenterContract)
......@@ -510,6 +509,10 @@ func (r *Renter) managedRenterContractsAndUtilities(entrys []*siafile.SiaFileSet
offline[pk.String()] = r.hostContractor.IsOffline(pk)
contracts[pk.String()] = contract
}
// Update the cached expiration of the siafiles.
for _, e := range entrys {
e.UpdateExpiration(contracts)
}
return offline, goodForRenew, contracts
}
......
......@@ -167,6 +167,13 @@ func New(siaPath modules.SiaPath, siaFilePath, source string, wal *writeaheadlog
for i := range file.chunks {
file.chunks[i].Pieces = make([][]piece, erasureCode.NumPieces())
}
// Init cached fields for 0-Byte files.
if file.staticMetadata.StaticFileSize == 0 {
file.staticMetadata.CachedHealth = 0
file.staticMetadata.CachedStuckHealth = 0
file.staticMetadata.CachedRedundancy = float64(erasureCode.NumPieces()) / float64(erasureCode.MinPieces())
file.staticMetadata.CachedUploadProgress = 100
}
// Save file.
return file, file.saveFile()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment