func (udc *unfinishedDownloadChunk) fail(err error) {
	udc.failed = true
	udc.recoveryComplete = true
	for i := range udc.physicalChunkData {
		udc.physicalChunkData[i] = nil
	}
	udc.download.managedFail(fmt.Errorf("chunk %v failed: %v", udc.staticChunkIndex, err))
	udc.destination = nil
}
fail will set the chunk status to failed. The physical chunk memory will be
wiped and any memory allocation will be returned to the renter. The download
as a whole will be failed as well.
package renter
import (
	"bytes"
	"fmt"
	"sync"
	"sync/atomic"
	"time"
	"github.com/NebulousLabs/Sia/crypto"
	"github.com/NebulousLabs/Sia/modules"
	"github.com/NebulousLabs/errors"
)
type downloadPieceInfo struct {
	index uint64
	root  crypto.Hash
}
type unfinishedDownloadChunk struct {
	destination downloadDestination  
	erasureCode modules.ErasureCoder
	masterKey   crypto.TwofishKey
	staticChunkIndex  uint64                        
	staticCacheID     string                        
	staticChunkMap    map[string]downloadPieceInfo  
	staticChunkSize   uint64
	staticFetchLength uint64  
	staticFetchOffset uint64  
	staticPieceSize   uint64
	staticWriteOffset int64  
	staticLatencyTarget time.Duration
	staticNeedsMemory   bool  
	staticOverdrive     int
	staticPriority      uint64
	failed            bool       
	physicalChunkData [][]byte   
	pieceUsage        []bool     
	piecesCompleted   int        
	piecesRegistered  int        
	recoveryComplete  bool       
	workersRemaining  int        
	workersStandby    []*worker  
	memoryAllocated uint64
	download *download
	mu       sync.Mutex
	staticStreamCache *streamCache
}