Both kinds of LamportsError are turned into InstructionError::ArithmeticOverflow anyway. (#26273)
This commit is contained in:
parent
de5b6a2989
commit
e8fed88669
|
@ -177,13 +177,11 @@ pub fn withdraw_nonce_account(
|
|||
return Err(InstructionError::MissingRequiredSignature);
|
||||
}
|
||||
|
||||
from.checked_sub_lamports(lamports)
|
||||
.map_err(|_| InstructionError::ArithmeticOverflow)?;
|
||||
from.checked_sub_lamports(lamports)?;
|
||||
drop(from);
|
||||
let mut to = instruction_context
|
||||
.try_borrow_instruction_account(transaction_context, to_account_index)?;
|
||||
to.checked_add_lamports(lamports)
|
||||
.map_err(|_| InstructionError::ArithmeticOverflow)?;
|
||||
to.checked_add_lamports(lamports)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ use {
|
|||
crate::{
|
||||
account::{AccountSharedData, ReadableAccount, WritableAccount},
|
||||
instruction::InstructionError,
|
||||
lamports::LamportsError,
|
||||
pubkey::Pubkey,
|
||||
},
|
||||
std::{
|
||||
|
@ -559,7 +558,7 @@ impl<'a> BorrowedAccount<'a> {
|
|||
self.set_lamports(
|
||||
self.get_lamports()
|
||||
.checked_add(lamports)
|
||||
.ok_or(LamportsError::ArithmeticOverflow)?,
|
||||
.ok_or(InstructionError::ArithmeticOverflow)?,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -568,7 +567,7 @@ impl<'a> BorrowedAccount<'a> {
|
|||
self.set_lamports(
|
||||
self.get_lamports()
|
||||
.checked_sub(lamports)
|
||||
.ok_or(LamportsError::ArithmeticUnderflow)?,
|
||||
.ok_or(InstructionError::ArithmeticOverflow)?,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue