/// Accept the public reply from a recipient and apply the reply to the relevant transaction protocol
/// # Arguments
/// 'recipient_reply' - The public response from a recipient with data required to complete the transaction
Accept the public reply from a recipient and apply the reply to the relevant transaction protocol
Accept the public reply from a recipient and apply the reply to the relevant transaction protocol
pub async fn accept_finalized_transaction(
        &mut self,
        source_pubkey: CommsPublicKey,
        finalized_transaction: proto::TransactionFinalizedMessage,
    ) -> Result<(), TransactionServiceError> {
        let tx_id = finalized_transaction.tx_id;
        let transaction: Transaction = finalized_transaction
            .transaction
            .ok_or_else(|| {
                TransactionServiceError::InvalidMessageError(
                    "Finalized Transaction missing Transaction field".to_string(),
                )
            })?
            .try_into()
            .map_err(|_| {
                TransactionServiceError::InvalidMessageError(
                    "Cannot convert Transaction field from TransactionFinalized message".to_string(),
                )
            })?;
        let sender = match self.finalized_transaction_senders.get_mut(&tx_id) {
            None => return Err(TransactionServiceError::TransactionDoesNotExistError),
            Some(s) => s,
        };
        sender
            .send((source_pubkey, tx_id, transaction))
            .await
            .map_err(|_| TransactionServiceError::ProtocolChannelError)?;
        Ok(())
    }
pub async fn accept_finalized_transaction ( & mut self , source_pubkey : CommsPublicKey , finalized_transaction : proto :: TransactionFinalizedMessage , ) -> Result < ( ) , TransactionServiceError > { let tx_id = finalized_transaction . tx_id ; let transaction : Transaction = finalized_transaction . transaction . ok_or_else ( | | { TransactionServiceError :: InvalidMessageError ( " " . to_string ( ) , ) } ) ? . try_into ( ) . map_err ( | _ | { TransactionServiceError :: InvalidMessageError ( " " . to_string ( ) , ) } ) ? ; let sender = match self . finalized_transaction_senders . get_mut ( & tx_id ) { None => return Err ( TransactionServiceError :: TransactionDoesNotExistError ) , Some ( s ) => s , } ; sender . send ( ( source_pubkey , tx_id , transaction ) ) . await . map_err ( | _ | TransactionServiceError :: ProtocolChannelError ) ? ; Ok ( ( ) ) }
Accept the public reply from a recipient and apply the reply to the relevant transaction protocol
Accept the public reply from a recipient and apply the reply to the relevant transaction protocol
&mut self
source_pubkey
CommsPublicKey
finalized_transaction
proto::TransactionFinalizedMessage