From e5113c333e1ed1b2d13221885a2c961253edeb71 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 22 Oct 2023 05:48:23 -0400 Subject: [PATCH] Move LastBatchBlock, LastBatch sets by their checks --- substrate/in-instructions/pallet/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/substrate/in-instructions/pallet/src/lib.rs b/substrate/in-instructions/pallet/src/lib.rs index a536f5c0a..c9a0f32d3 100644 --- a/substrate/in-instructions/pallet/src/lib.rs +++ b/substrate/in-instructions/pallet/src/lib.rs @@ -115,9 +115,6 @@ pub mod pallet { let batch = batch.batch; - LastBatchBlock::::insert(batch.network, frame_system::Pallet::::block_number()); - - LastBatch::::insert(batch.network, batch.id); LatestNetworkBlock::::insert(batch.network, batch.block); Self::deposit_event(Event::Batch { network: batch.network, @@ -195,6 +192,7 @@ pub mod pallet { if last_block >= current_block { Err(InvalidTransaction::Future)?; } + LastBatchBlock::::insert(batch.batch.network, frame_system::Pallet::::block_number()); // Verify the batch is sequential // LastBatch has the last ID set. The next ID should be it + 1 @@ -206,6 +204,7 @@ pub mod pallet { if batch.batch.id > expected { Err(InvalidTransaction::Future)?; } + LastBatch::::insert(batch.batch.network, batch.batch.id); // Verify all Balances in this Batch are for this network for instruction in &batch.batch.instructions {