modified verification to loop until success or failure
This commit is contained in:
@ -24,7 +24,6 @@ pub const MAX_ENTRY_IDS: usize = 1024 * 4;
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum AccountingError {
|
||||
AccountNotFound,
|
||||
BalanceUpdatedBeforeTransactionCompleted,
|
||||
InsufficientFunds,
|
||||
InvalidTransferSignature,
|
||||
}
|
||||
@ -142,6 +141,7 @@ impl Accountant {
|
||||
return Err(AccountingError::InvalidTransferSignature);
|
||||
}
|
||||
|
||||
loop {
|
||||
let bal = option.unwrap();
|
||||
let current = bal.load(Ordering::Relaxed) as i64;
|
||||
|
||||
@ -157,11 +157,12 @@ impl Accountant {
|
||||
Ordering::Relaxed,
|
||||
);
|
||||
|
||||
return match result {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err(AccountingError::BalanceUpdatedBeforeTransactionCompleted),
|
||||
match result {
|
||||
Ok(_) => return Ok(()),
|
||||
Err(_) => continue,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_verified_transaction_credits(&self, tr: &Transaction) {
|
||||
let mut plan = tr.data.plan.clone();
|
||||
|
Reference in New Issue
Block a user