lotus/chain/actors/params.go
2019-08-06 23:35:57 -07:00

20 lines
417 B
Go

package actors
import (
"github.com/filecoin-project/go-lotus/chain/actors/aerrors"
cbor "github.com/ipfs/go-ipld-cbor"
)
var (
EmptyStructCBOR = []byte{0xa0}
)
func SerializeParams(i interface{}) ([]byte, aerrors.ActorError) {
dump, err := cbor.DumpObject(i)
if err != nil {
// TODO: shouldnt this be a fatal error?
return nil, aerrors.Absorb(err, 1, "failed to encode parameter")
}
return dump, nil
}