Fail simulation if transaction contains duplicate accounts (#18304)
This commit is contained in:
@ -2616,8 +2616,17 @@ impl Bank {
|
|||||||
&'a self,
|
&'a self,
|
||||||
tx: &'b Transaction,
|
tx: &'b Transaction,
|
||||||
) -> TransactionBatch<'a, 'b> {
|
) -> TransactionBatch<'a, 'b> {
|
||||||
|
let check_transaction = |tx: &Transaction| -> Result<()> {
|
||||||
|
tx.sanitize().map_err(TransactionError::from)?;
|
||||||
|
if Accounts::has_duplicates(&tx.message.account_keys) {
|
||||||
|
Err(TransactionError::AccountLoadedTwice)
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let mut batch = TransactionBatch::new(
|
let mut batch = TransactionBatch::new(
|
||||||
vec![tx.sanitize().map_err(|e| e.into())],
|
vec![check_transaction(tx)],
|
||||||
self,
|
self,
|
||||||
Cow::Owned(vec![HashedTransaction::from(tx)]),
|
Cow::Owned(vec![HashedTransaction::from(tx)]),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user