Commit 5af32e27 authored by Luke Champine's avatar Luke Champine

simplify UploadParams pieces

parent 62eea745
......@@ -15,10 +15,8 @@ type UploadParams struct {
MerkleRoot hash.Hash
// these fields are not seen by the host
Nickname string
TotalPieces int
RequiredPieces int
OptimalPieces int
Nickname string
Pieces int
}
type RentInfo struct {
......
......@@ -67,7 +67,7 @@ func (r *Renter) Upload(up modules.UploadParams) (err error) {
return errors.New("file with that nickname already exists")
}
pieces := make([]FilePiece, up.TotalPieces)
pieces := make([]FilePiece, up.Pieces)
for i := range pieces {
// upload the piece to a host. The host is chosen by uploadPiece.
// TODO: what happens if we can't upload to all the hosts?
......
......@@ -50,8 +50,8 @@ func (d *daemon) fileUploadHandler(w http.ResponseWriter, req *http.Request) {
Duration: duration,
Delay: delay,
Nickname: req.FormValue("nickname"),
TotalPieces: pieces,
Nickname: req.FormValue("nickname"),
Pieces: pieces,
})
if err != nil {
http.Error(w, "Upload failed: "+err.Error(), 500)
......@@ -99,8 +99,8 @@ func (d *daemon) fileUploadPathHandler(w http.ResponseWriter, req *http.Request)
Duration: duration,
Delay: delay,
Nickname: req.FormValue("nickname"),
TotalPieces: pieces,
Nickname: req.FormValue("nickname"),
Pieces: pieces,
})
if err != nil {
http.Error(w, "Upload failed: "+err.Error(), 500)
......
......@@ -69,8 +69,8 @@ func (d *daemon) blockHistory() (blockIDs [32]consensus.BlockID) {
}
// always include the genesis block
genesis, err := d.state.BlockAtHeight(0)
if err != nil {
genesis, exists := d.state.BlockAtHeight(0)
if !exists {
// this should never happen
return
}
......
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