Don't fail process_entries with ProgramErrors (#2509)
This commit is contained in:
13
src/bank.rs
13
src/bank.rs
@ -659,11 +659,22 @@ impl Bank {
|
|||||||
let results: Vec<Result<()>> = entries
|
let results: Vec<Result<()>> = entries
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
.map(|(e, lock_results)| {
|
.map(|(e, lock_results)| {
|
||||||
let results = self.load_execute_and_commit_transactions(
|
let old_results = self.load_execute_and_commit_transactions(
|
||||||
&e.transactions,
|
&e.transactions,
|
||||||
lock_results.to_vec(),
|
lock_results.to_vec(),
|
||||||
MAX_ENTRY_IDS,
|
MAX_ENTRY_IDS,
|
||||||
);
|
);
|
||||||
|
let mut results = Vec::new();
|
||||||
|
results.reserve(old_results.len());
|
||||||
|
results = old_results
|
||||||
|
.into_iter()
|
||||||
|
.map(|result| match result {
|
||||||
|
// Entries that result in a ProgramError are still valid and are written in the
|
||||||
|
// ledger so map them to an ok return value
|
||||||
|
Err(BankError::ProgramError(_, _)) => Ok(()),
|
||||||
|
_ => result,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
self.unlock_accounts(&e.transactions, &results);
|
self.unlock_accounts(&e.transactions, &results);
|
||||||
Self::first_err(&results)
|
Self::first_err(&results)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user