fountain: Allow picking sector size

This commit is contained in:
Łukasz Magiera 2019-10-29 19:28:54 +01:00
parent 340e9177b2
commit 6a999d348a
2 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"os"
"strconv"
"time"
rice "github.com/GeertJohan/go.rice"
@ -200,6 +201,11 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
return
}
ssize, err := strconv.ParseInt(r.FormValue("sectorSize"), 10, 64)
if err != nil {
return
}
if owner.Protocol() != address.BLS {
w.WriteHeader(400)
w.Write([]byte("Miner address must use BLS"))
@ -254,7 +260,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
params, err := actors.SerializeParams(&actors.CreateStorageMinerParams{
Owner: owner,
Worker: owner,
SectorSize: 1 << 30, // build.SectorSizes[0], // TODO: dropdown allowing selection (1GiB for now)
SectorSize: uint64(ssize),
PeerID: peer.ID("SETME"),
})
if err != nil {

View File

@ -11,9 +11,14 @@
[CREATING STORAGE MINER]
</div>
<div class="Index-node" id="formnd">
<form id="f" action='/mkminer' method='get'>
<form id="f" action='/mkminer' method='POST'>
<span>Enter destination address:</span>
<input type='text' name='address' style="width: 300px">
<select name="sectorSize">
<option selected value="1073741824">1GiB sectors</option>
<option value="268435456">256MiB sectors</option>
<option value="16777216">16MiB sectors</option>
</select>
<button type='submit'>Create Miner</button>
</form>
</div>