@@ -23,6 +23,7 @@ use cstate::{FindActionHandler, StateDB, StateError, StateWithCache, TopLevelSta
2323use ctypes:: errors:: HistoryError ;
2424use ctypes:: machine:: { LiveBlock , Transactions } ;
2525use ctypes:: util:: unexpected:: Mismatch ;
26+ use ctypes:: BlockNumber ;
2627use cvm:: ChainTimeInfo ;
2728use primitives:: { Bytes , H256 } ;
2829use rlp:: { Decodable , DecoderError , Encodable , RlpStream , UntrustedRlp } ;
@@ -169,14 +170,23 @@ impl<'x> OpenBlock<'x> {
169170 tx : SignedTransaction ,
170171 h : Option < H256 > ,
171172 client : & C ,
173+ parent_block_number : BlockNumber ,
174+ parent_block_timestamp : u64 ,
172175 ) -> Result < ( ) , Error > {
173176 if self . block . transactions_set . contains ( & tx. hash ( ) ) {
174177 return Err ( HistoryError :: TransactionAlreadyImported . into ( ) )
175178 }
176179
177180 let hash = tx. hash ( ) ;
178181 let tracker = tx. tracker ( ) ;
179- let error = match self . block . state . apply ( & tx, & hash, & tx. signer_public ( ) , client) {
182+ let error = match self . block . state . apply (
183+ & tx,
184+ & hash,
185+ & tx. signer_public ( ) ,
186+ client,
187+ parent_block_number,
188+ parent_block_timestamp,
189+ ) {
180190 Ok ( ( ) ) => {
181191 self . block . transactions_set . insert ( h. unwrap_or ( hash) ) ;
182192 self . block . transactions . push ( tx) ;
@@ -201,9 +211,11 @@ impl<'x> OpenBlock<'x> {
201211 & mut self ,
202212 transactions : & [ SignedTransaction ] ,
203213 client : & C ,
214+ parent_block_number : BlockNumber ,
215+ parent_block_timestamp : u64 ,
204216 ) -> Result < ( ) , Error > {
205217 for tx in transactions {
206- self . push_transaction ( tx. clone ( ) , None , client) ?;
218+ self . push_transaction ( tx. clone ( ) , None , client, parent_block_number , parent_block_timestamp ) ?;
207219 }
208220 Ok ( ( ) )
209221 }
@@ -443,7 +455,7 @@ pub fn enact<C: ChainTimeInfo + FindActionHandler>(
443455 let mut b = OpenBlock :: try_new ( engine, db, parent, Address :: default ( ) , vec ! [ ] , is_epoch_begin) ?;
444456
445457 b. populate_from ( header) ;
446- b. push_transactions ( transactions, client) ?;
458+ b. push_transactions ( transactions, client, parent . number ( ) , parent . timestamp ( ) ) ?;
447459
448460 b. close_and_lock ( * parent. transactions_root ( ) )
449461}
0 commit comments