Skip to content

Commit

Permalink
feat: check encumbrance later (#6457)
Browse files Browse the repository at this point in the history
Description
---
move the encumbrance check to later in the send process

Motivation and Context
---
If we have this encumbrance check earlier, the wallet might encounter an
error and leave some outputs locked.

How Has This Been Tested?
---
manual
  • Loading branch information
SWvheerden committed Aug 8, 2024
1 parent 124bfd4 commit c8f0896
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions base_layer/wallet/src/transaction_service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1686,12 +1686,6 @@ where
.await
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;

self.resources
.output_manager_service
.confirm_pending_transaction(tx_id)
.await
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;

// Prepare receiver part of the transaction

// Diffie-Hellman shared secret `k_Ob * K_Sb = K_Ob * k_Sb` results in a public key, which is fed into
Expand Down Expand Up @@ -1832,6 +1826,12 @@ where
let fee = stp
.get_fee_amount()
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;

self.resources
.output_manager_service
.confirm_pending_transaction(tx_id)
.await
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;
self.submit_transaction(
transaction_broadcast_join_handles,
CompletedTransaction::new(
Expand Down Expand Up @@ -1940,11 +1940,6 @@ where
.await
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;

self.resources
.output_manager_service
.confirm_pending_transaction(tx_id)
.await
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;
let sender_message = TransactionSenderMessage::new_single_round_message(
stp.get_single_round_message(&self.resources.transaction_key_manager_service)
.await?,
Expand Down Expand Up @@ -2091,6 +2086,12 @@ where
let fee = stp
.get_fee_amount()
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;

self.resources
.output_manager_service
.confirm_pending_transaction(tx_id)
.await
.map_err(|e| TransactionServiceProtocolError::new(tx_id, e.into()))?;
self.submit_transaction(
transaction_broadcast_join_handles,
CompletedTransaction::new(
Expand Down

0 comments on commit c8f0896

Please sign in to comment.