Skip to content

Commit 9d5441a

Browse files
authored
Merge pull request #1025 from openmina/transaction_pool_fix
transaction logic: fix missing account updates when prevalidating tra…
2 parents c35d266 + 5de2d76 commit 9d5441a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ledger/src/scan_state/transaction_logic.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3301,6 +3301,13 @@ pub mod zkapp_command {
33013301
self.fold_impl(init, &mut fun)
33023302
}
33033303

3304+
pub fn exists<'a, F>(&'a self, mut fun: F) -> bool
3305+
where
3306+
F: FnMut(&'a AccUpdate) -> bool,
3307+
{
3308+
self.fold(false, |acc, x| acc || fun(x))
3309+
}
3310+
33043311
fn map_to_impl<F, AnotherAccUpdate: Clone + AccountUpdateRef>(
33053312
&self,
33063313
fun: &F,
@@ -3627,16 +3634,15 @@ pub mod zkapp_command {
36273634

36283635
pub fn has_zero_vesting_period(&self) -> bool {
36293636
self.account_updates
3630-
.iter()
3631-
.any(|p| match &p.elt.account_update.body.update.timing {
3637+
.exists(|account_update| match &account_update.body.update.timing {
36323638
SetOrKeep::Keep => false,
36333639
SetOrKeep::Set(Timing { vesting_period, .. }) => vesting_period.is_zero(),
36343640
})
36353641
}
36363642

36373643
pub fn is_incompatible_version(&self) -> bool {
3638-
self.account_updates.iter().any(|p| {
3639-
match &p.elt.account_update.body.update.permissions {
3644+
self.account_updates.exists(|account_update| {
3645+
match &account_update.body.update.permissions {
36403646
SetOrKeep::Keep => false,
36413647
SetOrKeep::Set(Permissions {
36423648
set_verification_key,

0 commit comments

Comments
 (0)