fix a few multisig cli issues

This commit is contained in:
whyrusleeping 2020-07-20 17:17:53 -07:00
parent 34fffb90d5
commit 42a7cb1248
3 changed files with 15 additions and 8 deletions

View File

@ -5,11 +5,12 @@ import (
"context"
"encoding/binary"
"encoding/json"
"github.com/filecoin-project/lotus/lib/adtutil"
"io"
"os"
"sync"
"github.com/filecoin-project/lotus/lib/adtutil"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/minio/blake2b-simd"
@ -659,7 +660,7 @@ func (cs *ChainStore) GetCMessage(c cid.Cid) (types.ChainMsg, error) {
return m, nil
}
if err != bstore.ErrNotFound {
log.Warn("GetCMessage: unexpected error getting unsigned message: %s", err)
log.Warnf("GetCMessage: unexpected error getting unsigned message: %s", err)
}
return cs.GetSignedMessage(c)

View File

@ -364,12 +364,17 @@ var msigProposeCmd = &cli.Command{
return fmt.Errorf("proposal returned exit %d", wait.Receipt.ExitCode)
}
_, v, err := cbg.CborReadHeader(bytes.NewReader(wait.Receipt.Return))
if err != nil {
return err
var retval samsig.ProposeReturn
if err := retval.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
return fmt.Errorf("failed to unmarshal propose return value: %w", err)
}
fmt.Printf("Transaction ID: %d\n", v)
fmt.Printf("Transaction ID: %d\n", retval.TxnID)
if retval.Applied {
fmt.Printf("Transaction was executed during propose\n")
fmt.Printf("Exit Code: %d\n", retval.Code)
fmt.Printf("Return Value: %x\n", retval.Ret)
}
return nil
},

View File

@ -2,6 +2,7 @@ package full
import (
"context"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/go-address"
@ -115,7 +116,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr
Params: params,
})
if actErr != nil {
return cid.Undef, actErr
return cid.Undef, xerrors.Errorf("failed to serialize parameters: %w", actErr)
}
msg := &types.Message{
@ -130,7 +131,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr
smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, msg)
if err != nil {
return cid.Undef, nil
return cid.Undef, xerrors.Errorf("failed to push message: %w", err)
}
return smsg.Cid(), nil