mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-06 23:33:10 +00:00
consume call stack from the other end
This commit is contained in:
parent
103332f6cd
commit
aba1d844f8
@ -1,4 +1,4 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
|
||||
use nssa_core::{
|
||||
account::{Account, AccountId, AccountWithMetadata},
|
||||
@ -108,10 +108,10 @@ impl PublicTransaction {
|
||||
pre_states: input_pre_states,
|
||||
};
|
||||
|
||||
let mut chained_calls = Vec::from_iter([initial_call]);
|
||||
let mut chained_calls = VecDeque::from_iter([initial_call]);
|
||||
let mut chain_calls_counter = 0;
|
||||
|
||||
while let Some(chained_call) = chained_calls.pop() {
|
||||
while let Some(chained_call) = chained_calls.pop_front() {
|
||||
if chain_calls_counter > MAX_NUMBER_CHAINED_CALLS {
|
||||
return Err(NssaError::MaxChainedCallsDepthExceeded);
|
||||
}
|
||||
@ -168,7 +168,7 @@ impl PublicTransaction {
|
||||
state_diff.insert(pre.account_id, post.clone());
|
||||
}
|
||||
|
||||
chained_calls.extend_from_slice(&program_output.chained_calls);
|
||||
chained_calls.extend(program_output.chained_calls);
|
||||
chain_calls_counter += 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user