/// Handle a Transaction Cancelled message received from the Comms layer
Handle a Transaction Cancelled message received from the Comms layer
Handle a Transaction Cancelled message received from the Comms layer
pub async fn handle_transaction_cancelled_message(
        &mut self,
        source_pubkey: CommsPublicKey,
        transaction_cancelled: proto::TransactionCancelledMessage,
    ) -> Result<(), TransactionServiceError>
    {
        let tx_id = transaction_cancelled.tx_id;
        // Check that an inbound transaction exists to be cancelled and that the Source Public key for that transaction
        // is the same as the cancellation message
        if let Ok(inbound_tx) = self.db.get_pending_inbound_transaction(tx_id).await {
            if inbound_tx.source_public_key == source_pubkey {
                self.cancel_transaction(tx_id).await?;
            } else {
                trace!(
                    target: LOG_TARGET,
                    "Received a Transaction Cancelled (TxId: {}) message from an unknown source, ignoring",
                    tx_id
                );
            }
        }
        Ok(())
    }
pub async fn handle_transaction_cancelled_message ( & mut self , source_pubkey : CommsPublicKey , transaction_cancelled : proto :: TransactionCancelledMessage , ) -> Result < ( ) , TransactionServiceError > { let tx_id = transaction_cancelled . tx_id ; // Check that an inbound transaction exists to be cancelled and that the Source Public key for that transaction // is the same as the cancellation message if let Ok ( inbound_tx ) = self . db . get_pending_inbound_transaction ( tx_id ) . await { if inbound_tx . source_public_key == source_pubkey { self . cancel_transaction ( tx_id ) . await ? ; } else { trace ! ( target LOG_TARGET " " tx_id ) ; } } Ok ( ( ) ) }
Handle a Transaction Cancelled message received from the Comms layer
Handle a Transaction Cancelled message received from the Comms layer
&mut self
source_pubkey
CommsPublicKey
transaction_cancelled
proto::TransactionCancelledMessage