public Project(LHProtos.Project proto) throws PaymentProtocolException, InvalidProtocolBufferException {
hash = Sha256Hash.create(proto.toByteArray());
// "Cast" it to a regular BIP70 payment request, possibly losing data along the way, but that's OK
// because we only want to do this to reuse the existing APIs.
Protos.PaymentRequest paymentRequest = Protos.PaymentRequest.parseFrom(proto.toByteString());
PaymentSession session = new PaymentSession(paymentRequest, false);
this.outputs = ImmutableList.copyOf(session.getSendRequest().tx.getOutputs());
this.params = session.getNetworkParameters();
this.projectReq = LHProtos.ProjectDetails.parseFrom(proto.getSerializedPaymentDetails());
this.goalAmount = this.projectReq.getOutputsList().stream().mapToLong(LHProtos.Output::getAmount).sum();
this.minPledgeAmount = this.projectReq.getExtraDetails().getMinPledgeSize();
if (this.goalAmount <= 0)
throw new Ex.ValueMismatch(this.goalAmount);