remove unused argument from newSectionDownload

parent b663ba94
......@@ -123,7 +123,7 @@ type (
)
// newSectionDownload initialises and returns a download object for the specified chunk.
func (r *Renter) newSectionDownload(f *file, destination modules.DownloadWriter, currentContracts map[modules.NetAddress]types.FileContractID, offset, length uint64) *download {
func (r *Renter) newSectionDownload(f *file, destination modules.DownloadWriter, offset, length uint64) *download {
d := newDownload(f, destination)
if length == 0 {
......@@ -145,7 +145,7 @@ func (r *Renter) newSectionDownload(f *file, destination modules.DownloadWriter,
d.finishedChunks[i] = false
}
d.initPieceSet(f, currentContracts, r)
d.initPieceSet(f, r)
return d
}
......@@ -166,8 +166,7 @@ func newDownload(f *file, destination modules.DownloadWriter) *download {
}
// initPieceSet initialises the piece set, including calculations of the total download size.
func (d *download) initPieceSet(f *file,
currentContracts map[modules.NetAddress]types.FileContractID, r *Renter) {
func (d *download) initPieceSet(f *file, r *Renter) {
// Allocate the piece size and progress bar so that the download will
// finish at exactly 100%. Due to rounding error and padding, there is not
// a strict mapping between 'progress' and 'bytes downloaded' - it is
......
......@@ -7,7 +7,6 @@ import (
"sync/atomic"
"github.com/NebulousLabs/Sia/modules"
"github.com/NebulousLabs/Sia/types"
)
// Download performs a file download using the passed parameters.
......@@ -48,12 +47,6 @@ func (r *Renter) Download(p modules.RenterDownloadParameters) error {
dw = NewDownloadFileWriter(p.Destination, p.Offset, p.Length)
}
// Build current contracts map.
currentContracts := make(map[modules.NetAddress]types.FileContractID)
for _, contract := range r.hostContractor.Contracts() {
currentContracts[contract.NetAddress] = contract.ID
}
// sentinel: if length == 0, download the entire file
if p.Length == 0 {
p.Length = file.size - p.Offset
......@@ -64,7 +57,7 @@ func (r *Renter) Download(p modules.RenterDownloadParameters) error {
}
// Create the download object and add it to the queue.
d := r.newSectionDownload(file, dw, currentContracts, p.Offset, p.Length)
d := r.newSectionDownload(file, dw, p.Offset, p.Length)
lockID = r.mu.Lock()
r.downloadQueue = append(r.downloadQueue, d)
......
......@@ -13,7 +13,6 @@ import (
"github.com/NebulousLabs/Sia/build"
"github.com/NebulousLabs/Sia/crypto"
"github.com/NebulousLabs/Sia/modules"
"github.com/NebulousLabs/Sia/types"
)
......@@ -319,12 +318,6 @@ func (r *Renter) managedDownloadChunkData(rs *repairState, file *file, offset ui
rs.downloadingChunks[chunkID] = struct{}{}
defer delete(rs.downloadingChunks, chunkID)
// build current contracts map
currentContracts := make(map[modules.NetAddress]types.FileContractID)
for _, contract := range r.hostContractor.Contracts() {
currentContracts[contract.NetAddress] = contract.ID
}
downloadSize := file.chunkSize()
if offset+downloadSize > file.size {
downloadSize = file.size - offset
......@@ -334,7 +327,7 @@ func (r *Renter) managedDownloadChunkData(rs *repairState, file *file, offset ui
buf := NewDownloadBufferWriter(file.chunkSize(), int64(offset))
// create the download object and push it on to the download queue
d := r.newSectionDownload(file, buf, currentContracts, offset, downloadSize)
d := r.newSectionDownload(file, buf, offset, downloadSize)
done := make(chan struct{})
defer close(done)
go func() {
......
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