func VerificationWitnessFromProto(vw *pb.VerificationWitness) (*VerificationWitness, error) {
	if vw.LastLevel > 255 {
		return nil, fmt.Errorf("LastLevel should be under 255")
	}

	witnesses := make([]chainhash.Hash, len(vw.WitnessHashes))
	for i := range witnesses {
		err := witnesses[i].SetBytes(vw.WitnessHashes[i])
		if err != nil {
			return nil, err
		}
	}

	out := &VerificationWitness{
		LastLevel: uint8(vw.LastLevel),
		Witnesses: witnesses,
	}

	err := out.Key.SetBytes(vw.Key)
	if err != nil {
		return nil, err
	}

	err = out.Value.SetBytes(vw.Value)
	if err != nil {
		return nil, err
	}

	err = out.WitnessBitfield.SetBytes(vw.WitnessBitfield)
	if err != nil {
		return nil, err
	}

	return out, nil
}
// VerificationWitnessFromProto converts a protobuf representation of a verification witness.
VerificationWitnessFromProto converts a protobuf representation of a verification witness.
// VerificationWitnessFromProto converts a protobuf representation of a verification witness .
func VerificationWitnessFromProto(vw *pb.VerificationWitness) (*VerificationWitness, error) {
	if vw.LastLevel > 255 {
		return nil, fmt.Errorf("LastLevel should be under 255")
	}
	witnesses := make([]chainhash.Hash, len(vw.WitnessHashes))
	for i := range witnesses {
		err := witnesses[i].SetBytes(vw.WitnessHashes[i])
		if err != nil {
			return nil, err
		}
	}
	out := &VerificationWitness{
		LastLevel: uint8(vw.LastLevel),
		Witnesses: witnesses,
	}
	err := out.Key.SetBytes(vw.Key)
	if err != nil {
		return nil, err
	}
	err = out.Value.SetBytes(vw.Value)
	if err != nil {
		return nil, err
	}
	err = out.WitnessBitfield.SetBytes(vw.WitnessBitfield)
	if err != nil {
		return nil, err
	}
	return out, nil
}
func VerificationWitnessFromProto ( vw * pb . VerificationWitness ) ( * VerificationWitness , error ) { if vw . LastLevel > 255 { return nil , fmt . Errorf ( " " ) } witnesses := make ( [ ] chainhash . Hash , len ( vw . WitnessHashes ) ) for i := range witnesses { err := witnesses [ i ] . SetBytes ( vw . WitnessHashes [ i ] ) if err != nil { return nil , err } } out := & VerificationWitness { LastLevel : uint8 ( vw . LastLevel ) , Witnesses : witnesses , } err := out . Key . SetBytes ( vw . Key ) if err != nil { return nil , err } err = out . Value . SetBytes ( vw . Value ) if err != nil { return nil , err } err = out . WitnessBitfield . SetBytes ( vw . WitnessBitfield ) if err != nil { return nil , err } return out , nil }
VerificationWitnessFromProto converts a protobuf representation of a verification witness.
VerificationWitnessFromProto converts a protobuf representation of a verification witness .