pub fn verify_multiple_payment_proofs<R: Rng, E: Engine>(csprng: &mut R,
                                                             channel_state: &ChannelState<E>,
                                                             sender_payment: &Payment<E>,
                                                             receiver_payment: &Payment<E>,
                                                             merch_state: &mut MerchantState<E>)
                                                             -> BoltResult<(cl::Signature<E>, cl::Signature<E>)> {
        let tx_fee = channel_state.get_channel_fee();
        let amount = sender_payment.amount + receiver_payment.amount;
        if amount != 0 { // we want to check this relation in ZK without knowing the amount
            return Err(String::from("payments do not offset"));
        }

        let new_close_token = merch_state.verify_payment(csprng, &channel_state,
                                                         &sender_payment.proof, &sender_payment.com, &sender_payment.wpk, sender_payment.amount + tx_fee).unwrap();

        let cond_close_token = merch_state.verify_payment(csprng, &channel_state,
                                                          &receiver_payment.proof, &receiver_payment.com, &receiver_payment.wpk, receiver_payment.amount + tx_fee).unwrap();

        // store the wpk since it has been revealed
        update_merchant_state(&mut merch_state.keys, &sender_payment.wpk, None);
        update_merchant_state(&mut merch_state.keys, &receiver_payment.wpk, None);

        return Ok(Some((new_close_token, cond_close_token)));
    }
///
/// Verify third party payment proof from two bi-directional channel payments with intermediary (payment amount
///
Verify third party payment proof from two bi-directional channel payments with intermediary (payment amount
Verify third party payment proof from two bi - directional channel payments with intermediary ( payment amount
pub fn verify_multiple_payment_proofs<R: Rng, E: Engine>(csprng: &mut R,
                                                             channel_state: &ChannelState<E>,
                                                             sender_payment: &Payment<E>,
                                                             receiver_payment: &Payment<E>,
                                                             merch_state: &mut MerchantState<E>)
                                                             -> BoltResult<(cl::Signature<E>, cl::Signature<E>)> {
        let tx_fee = channel_state.get_channel_fee();
        let amount = sender_payment.amount + receiver_payment.amount;
        if amount != 0 { // we want to check this relation in ZK without knowing the amount
            return Err(String::from("payments do not offset"));
        }
        let new_close_token = merch_state.verify_payment(csprng, &channel_state,
                                                         &sender_payment.proof, &sender_payment.com, &sender_payment.wpk, sender_payment.amount + tx_fee).unwrap();
        let cond_close_token = merch_state.verify_payment(csprng, &channel_state,
                                                          &receiver_payment.proof, &receiver_payment.com, &receiver_payment.wpk, receiver_payment.amount + tx_fee).unwrap();
        // store the wpk since it has been revealed
        update_merchant_state(&mut merch_state.keys, &sender_payment.wpk, None);
        update_merchant_state(&mut merch_state.keys, &receiver_payment.wpk, None);
        return Ok(Some((new_close_token, cond_close_token)));
    }
pub fn verify_multiple_payment_proofs < R : Rng , E : Engine > ( csprng : & mut R , channel_state : & ChannelState < E > , sender_payment : & Payment < E > , receiver_payment : & Payment < E > , merch_state : & mut MerchantState < E > ) -> BoltResult < ( cl :: Signature < E > , cl :: Signature < E > ) > { let tx_fee = channel_state . get_channel_fee ( ) ; let amount = sender_payment . amount + receiver_payment . amount ; if amount != 0 { // we want to check this relation in ZK without knowing the amount return Err ( String :: from ( " " ) ) ; } let new_close_token = merch_state . verify_payment ( csprng , & channel_state , & sender_payment . proof , & sender_payment . com , & sender_payment . wpk , sender_payment . amount + tx_fee ) . unwrap ( ) ; let cond_close_token = merch_state . verify_payment ( csprng , & channel_state , & receiver_payment . proof , & receiver_payment . com , & receiver_payment . wpk , receiver_payment . amount + tx_fee ) . unwrap ( ) ; // store the wpk since it has been revealed update_merchant_state ( & mut merch_state . keys , & sender_payment . wpk , None ) ; update_merchant_state ( & mut merch_state . keys , & receiver_payment . wpk , None ) ; return Ok ( Some ( ( new_close_token , cond_close_token ) ) ) ; }
Verify third party payment proof from two bi-directional channel payments with intermediary (payment amount
Verify third party payment proof from two bi - directional channel payments with intermediary ( payment amount
csprng
&mut R
channel_state
&ChannelState<E>
sender_payment
&Payment<E>
receiver_payment
&Payment<E>
merch_state
&mut MerchantState<E>
csprng
&mut R
channel_state
&ChannelState<E>
sender_payment
&Payment<E>
receiver_payment
&Payment<E>
merch_state
&mut MerchantState<E>