some errcheck discoveries

This commit is contained in:
whyrusleeping 2019-12-04 21:02:14 -08:00
parent 613a0a05a0
commit df069af5e5
3 changed files with 19 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/filecoin-project/lotus/chain/address" "github.com/filecoin-project/lotus/chain/address"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"golang.org/x/xerrors"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"gopkg.in/urfave/cli.v2" "gopkg.in/urfave/cli.v2"
@ -176,7 +177,18 @@ var stateReplaySetCmd = &cli.Command{
return err return err
} }
api.StateReplay(ctx, ts, mcid) res, err := api.StateReplay(ctx, ts, mcid)
if err != nil {
return xerrors.Errorf("replay call failed: %w", err)
}
fmt.Println("Replay receipt:")
fmt.Printf("Exit code: %d\n", res.Receipt.ExitCode)
fmt.Printf("Return: %x\n", res.Receipt.Return)
fmt.Printf("Gas Used: %s\n", res.Receipt.GasUsed)
if res.Receipt.ExitCode != 0 {
fmt.Printf("Error message: %q\n", res.Error)
}
return nil return nil
}, },

View File

@ -49,7 +49,9 @@ func ClientBlockstore(fstore dtypes.ClientFilestore) dtypes.ClientBlockstore {
// request validator with the data transfer module as the validator for // request validator with the data transfer module as the validator for
// StorageDataTransferVoucher types // StorageDataTransferVoucher types
func RegisterClientValidator(crv *deals.ClientRequestValidator, dtm dtypes.ClientDataTransfer) { func RegisterClientValidator(crv *deals.ClientRequestValidator, dtm dtypes.ClientDataTransfer) {
dtm.RegisterVoucherType(reflect.TypeOf(deals.StorageDataTransferVoucher{}), crv) if err := dtm.RegisterVoucherType(reflect.TypeOf(deals.StorageDataTransferVoucher{}), crv); err != nil {
panic(err)
}
} }
// NewClientDAGServiceDataTransfer returns a data transfer manager that just // NewClientDAGServiceDataTransfer returns a data transfer manager that just

View File

@ -139,7 +139,9 @@ func HandleDeals(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, h *de
// request validator with the data transfer module as the validator for // request validator with the data transfer module as the validator for
// StorageDataTransferVoucher types // StorageDataTransferVoucher types
func RegisterProviderValidator(mrv *deals.ProviderRequestValidator, dtm dtypes.ProviderDataTransfer) { func RegisterProviderValidator(mrv *deals.ProviderRequestValidator, dtm dtypes.ProviderDataTransfer) {
dtm.RegisterVoucherType(reflect.TypeOf(deals.StorageDataTransferVoucher{}), mrv) if err := dtm.RegisterVoucherType(reflect.TypeOf(deals.StorageDataTransferVoucher{}), mrv); err != nil {
panic(err)
}
} }
// NewProviderDAGServiceDataTransfer returns a data transfer manager that just // NewProviderDAGServiceDataTransfer returns a data transfer manager that just