Skip to content

Commit

Permalink
Move LastBatchBlock, LastBatch sets by their checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Oct 22, 2023
1 parent 6068978 commit e5113c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions substrate/in-instructions/pallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ pub mod pallet {

let batch = batch.batch;

LastBatchBlock::<T>::insert(batch.network, frame_system::Pallet::<T>::block_number());

LastBatch::<T>::insert(batch.network, batch.id);
LatestNetworkBlock::<T>::insert(batch.network, batch.block);
Self::deposit_event(Event::Batch {
network: batch.network,
Expand Down Expand Up @@ -195,6 +192,7 @@ pub mod pallet {
if last_block >= current_block {
Err(InvalidTransaction::Future)?;
}
LastBatchBlock::<T>::insert(batch.batch.network, frame_system::Pallet::<T>::block_number());

// Verify the batch is sequential
// LastBatch has the last ID set. The next ID should be it + 1
Expand All @@ -206,6 +204,7 @@ pub mod pallet {
if batch.batch.id > expected {
Err(InvalidTransaction::Future)?;
}
LastBatch::<T>::insert(batch.batch.network, batch.batch.id);

// Verify all Balances in this Batch are for this network
for instruction in &batch.batch.instructions {
Expand Down

0 comments on commit e5113c3

Please sign in to comment.