From 51b630a5127474a72f5ee829168131aecd9f6494 Mon Sep 17 00:00:00 2001 From: David Main <51991544+StriderDM@users.noreply.github.com> Date: Mon, 20 Sep 2021 10:48:23 +0200 Subject: [PATCH] fix: additional check for cancelled transactions --- .../wallet/src/transaction_service/service.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/base_layer/wallet/src/transaction_service/service.rs b/base_layer/wallet/src/transaction_service/service.rs index c5fbb892d2..85685e8a96 100644 --- a/base_layer/wallet/src/transaction_service/service.rs +++ b/base_layer/wallet/src/transaction_service/service.rs @@ -1217,8 +1217,21 @@ where traced_message_tag ); + // Check if this transaction has already been received and cancelled. + if let Ok(inbound_tx) = self.db.get_cancelled_pending_inbound_transaction(data.tx_id).await { + if inbound_tx.source_public_key != source_pubkey { + return Err(TransactionServiceError::InvalidSourcePublicKey); + } + trace!( + target: LOG_TARGET, + "A repeated Transaction (TxId: {}) has been received but has been previously cancelled", + inbound_tx.tx_id + ); + return Ok(()); + } + // Check if this transaction has already been received. - if let Ok(inbound_tx) = self.db.get_pending_inbound_transaction(data.tx_id).await { + if let Ok(inbound_tx) = self.db.get_pending_inbound_transaction(data.clone().tx_id).await { // Check that it is from the same person if inbound_tx.source_public_key != source_pubkey { return Err(TransactionServiceError::InvalidSourcePublicKey);