mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-03-28 21:23:36 +00:00
use curr_time from new block
This commit is contained in:
parent
b92dcbb711
commit
4f38dec019
@ -16,6 +16,7 @@ use mempool::{MemPool, MemPoolHandle};
|
||||
#[cfg(feature = "mock")]
|
||||
pub use mock::SequencerCoreWithMockClients;
|
||||
use nssa::V03State;
|
||||
use nssa_core::program::Timestamp;
|
||||
pub use storage::error::DbError;
|
||||
use testnet_initial_state::initial_state;
|
||||
|
||||
@ -162,24 +163,20 @@ impl<BC: BlockSettlementClientTrait, IC: IndexerClientTrait> SequencerCore<BC, I
|
||||
(sequencer_core, mempool_handle)
|
||||
}
|
||||
|
||||
fn next_block_timestamp_ms() -> nssa_core::program::Timestamp {
|
||||
u64::try_from(chrono::Utc::now().timestamp_millis()).expect("Timestamp must be positive")
|
||||
}
|
||||
|
||||
fn execute_check_transaction_on_state(
|
||||
&mut self,
|
||||
tx: NSSATransaction,
|
||||
block_id: u64,
|
||||
curr_time: Timestamp,
|
||||
) -> Result<NSSATransaction, nssa::error::NssaError> {
|
||||
let block_id = self.next_block_id();
|
||||
let timestamp_ms = Self::next_block_timestamp_ms();
|
||||
match &tx {
|
||||
NSSATransaction::Public(tx) => {
|
||||
self.state
|
||||
.transition_from_public_transaction(tx, block_id, timestamp_ms)
|
||||
.transition_from_public_transaction(tx, block_id, curr_time)
|
||||
}
|
||||
NSSATransaction::PrivacyPreserving(tx) => self
|
||||
.state
|
||||
.transition_from_privacy_preserving_transaction(tx, block_id, timestamp_ms),
|
||||
.transition_from_privacy_preserving_transaction(tx, block_id, curr_time),
|
||||
NSSATransaction::ProgramDeployment(tx) => self
|
||||
.state
|
||||
.transition_from_program_deployment_transaction(tx),
|
||||
@ -256,7 +253,7 @@ impl<BC: BlockSettlementClientTrait, IC: IndexerClientTrait> SequencerCore<BC, I
|
||||
break;
|
||||
}
|
||||
|
||||
match self.execute_check_transaction_on_state(tx) {
|
||||
match self.execute_check_transaction_on_state(tx, new_block_height, curr_time) {
|
||||
Ok(valid_tx) => {
|
||||
valid_transactions.push(valid_tx);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user