func TransactionPackageFromProto(tp *pb.TransactionPackage) (*TransactionPackage, error) {
	outTp := &TransactionPackage{
		Updates: make([]UpdateWitness, len(tp.UpdateWitnesses)),
		Verifications: make([]VerificationWitness, len(tp.VerificationWitnesses)),
		Transactions: make([]ShardTransaction, len(tp.Transactions)),
	}

	err := outTp.StartRoot.SetBytes(tp.StartRoot)
	if err != nil {
		return nil, err
	}

	err = outTp.EndRoot.SetBytes(tp.EndRoot)
	if err != nil {
		return nil, err
	}

	for i := range outTp.Updates {
		u, err := UpdateWitnessFromProto(tp.UpdateWitnesses[i])
		if err != nil {
			return nil, err
		}
		outTp.Updates[i] = *u
	}

	for i := range outTp.Verifications {
		v, err := VerificationWitnessFromProto(tp.VerificationWitnesses[i])
		if err != nil {
			return nil, err
		}
		outTp.Verifications[i] = *v
	}

	for i := range outTp.Transactions {
		t, err := ShardTransactionFromProto(tp.Transactions[i])
		if err != nil {
			return nil, err
		}
		outTp.Transactions[i] = *t
	}

	return outTp, nil
}
// TransactionPackageFromProto converts a protobuf representation of a transaction package to normal form.
TransactionPackageFromProto converts a protobuf representation of a transaction package to normal form.
// TransactionPackageFromProto converts a protobuf representation of a transaction package to normal form .
func TransactionPackageFromProto(tp *pb.TransactionPackage) (*TransactionPackage, error) {
	outTp := &TransactionPackage{
		Updates: make([]UpdateWitness, len(tp.UpdateWitnesses)),
		Verifications: make([]VerificationWitness, len(tp.VerificationWitnesses)),
		Transactions: make([]ShardTransaction, len(tp.Transactions)),
	}
	err := outTp.StartRoot.SetBytes(tp.StartRoot)
	if err != nil {
		return nil, err
	}
	err = outTp.EndRoot.SetBytes(tp.EndRoot)
	if err != nil {
		return nil, err
	}
	for i := range outTp.Updates {
		u, err := UpdateWitnessFromProto(tp.UpdateWitnesses[i])
		if err != nil {
			return nil, err
		}
		outTp.Updates[i] = *u
	}
	for i := range outTp.Verifications {
		v, err := VerificationWitnessFromProto(tp.VerificationWitnesses[i])
		if err != nil {
			return nil, err
		}
		outTp.Verifications[i] = *v
	}
	for i := range outTp.Transactions {
		t, err := ShardTransactionFromProto(tp.Transactions[i])
		if err != nil {
			return nil, err
		}
		outTp.Transactions[i] = *t
	}
	return outTp, nil
}
func TransactionPackageFromProto ( tp * pb . TransactionPackage ) ( * TransactionPackage , error ) { outTp := & TransactionPackage { Updates : make ( [ ] UpdateWitness , len ( tp . UpdateWitnesses ) ) , Verifications : make ( [ ] VerificationWitness , len ( tp . VerificationWitnesses ) ) , Transactions : make ( [ ] ShardTransaction , len ( tp . Transactions ) ) , } err := outTp . StartRoot . SetBytes ( tp . StartRoot ) if err != nil { return nil , err } err = outTp . EndRoot . SetBytes ( tp . EndRoot ) if err != nil { return nil , err } for i := range outTp . Updates { u , err := UpdateWitnessFromProto ( tp . UpdateWitnesses [ i ] ) if err != nil { return nil , err } outTp . Updates [ i ] = * u } for i := range outTp . Verifications { v , err := VerificationWitnessFromProto ( tp . VerificationWitnesses [ i ] ) if err != nil { return nil , err } outTp . Verifications [ i ] = * v } for i := range outTp . Transactions { t , err := ShardTransactionFromProto ( tp . Transactions [ i ] ) if err != nil { return nil , err } outTp . Transactions [ i ] = * t } return outTp , nil }
TransactionPackageFromProto converts a protobuf representation of a transaction package to normal form.
TransactionPackageFromProto converts a protobuf representation of a transaction package to normal form .