Esempio n. 1
0
// DeserializeBlockSeqFunc deserializes a BlockSeqFunc.
func DeserializeBlockSeqFunc(d []byte) (*BlockSeqFunc, error) {
	obj, err := serializer.DeserializeWithType(d)
	if err != nil {
		return nil, err
	}
	block, ok := obj.(Block)
	if !ok {
		return nil, fmt.Errorf("expected Block but got %T", obj)
	}
	return &BlockSeqFunc{B: block}, nil
}
Esempio n. 2
0
// DeserializeStateOutBlock deserializes a StateOutBlock.
func DeserializeStateOutBlock(d []byte) (*StateOutBlock, error) {
	b, err := serializer.DeserializeWithType(d)
	if err != nil {
		return nil, err
	}
	block, ok := b.(Block)
	if !ok {
		return nil, fmt.Errorf("wrapped object is not a Block: %T", b)
	}
	return &StateOutBlock{Block: block}, nil
}