From 9391d4405168c97cb4fb16c6a07af9ffc90ecaba Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 13 Nov 2023 13:43:34 +0800 Subject: [PATCH] Fix issue #65:wrong timestamp on chain --- m1/subnet/src/vm/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/m1/subnet/src/vm/mod.rs b/m1/subnet/src/vm/mod.rs index 8123205a..54b3a98d 100644 --- a/m1/subnet/src/vm/mod.rs +++ b/m1/subnet/src/vm/mod.rs @@ -1417,6 +1417,7 @@ impl ChainVm for Vm if let Some(state_b) = vm_state.state.as_ref() { let prnt_blk = state_b.get_block(&vm_state.preferred).await.unwrap(); let unix_now = Utc::now().timestamp() as u64; + let unix_micro = Utc::now().timestamp_micros() as u64; let tx_arr = self.get_pending_tx(10000).await; println!("----build_block pool tx count-------{}------", tx_arr.clone().len()); let executor = self.executor.as_ref().unwrap().read().await; @@ -1432,7 +1433,7 @@ impl ChainVm for Vm signer.author(), vec![], vec![], - unix_now, + unix_micro, )); let mut txs = vec![]; for tx in tx_arr.iter() { @@ -1448,7 +1449,7 @@ impl ChainVm for Vm block_id.clone(), parent_block_id, next_epoch, - unix_now); + unix_micro); let mut block_ = Block::new( prnt_blk.id(),