Merge pull request #1339 from filecoin-project/fix/fountain-create-miner-return

fountain: decode create miner results correctly
This commit is contained in:
Łukasz Magiera 2020-03-06 09:14:05 +01:00 committed by GitHub
commit b019e41f1c

View File

@ -1,6 +1,7 @@
package main
import (
"bytes"
"context"
"fmt"
"net"
@ -345,12 +346,13 @@ func (h *handler) msgwaitaddr(w http.ResponseWriter, r *http.Request) {
}
w.WriteHeader(200)
addr, err := address.NewFromBytes(mw.Receipt.Return)
if err != nil {
var ma power.CreateMinerReturn
if err := ma.UnmarshalCBOR(bytes.NewReader(mw.Receipt.Return)); err != nil {
log.Errorf("%w", err)
w.WriteHeader(400)
w.Write([]byte(err.Error()))
return
}
fmt.Fprintf(w, "{\"addr\": \"%s\"}", addr)
fmt.Fprintf(w, "{\"addr\": \"%s\"}", ma.IDAddress)
}