11use clap:: Parser ;
2- use ethers:: types:: { Address , Block , H256 , Transaction , U256 } ;
2+ use ethers:: types:: { Block , H256 , U256 } ;
33use eyre:: Result ;
4- use jsonrpsee:: http_client:: HttpClientBuilder ;
54use jsonrpsee:: core:: client:: ClientT ;
5+ use jsonrpsee:: http_client:: HttpClientBuilder ;
66use std:: time:: Duration ;
77
88#[ derive( Parser , Debug ) ]
@@ -53,7 +53,6 @@ async fn main() -> Result<()> {
5353 let _: ( ) = client. request ( "flash_ingestBlock" , ( block_1, ) ) . await ?;
5454 tokio:: time:: sleep ( Duration :: from_millis ( 500 ) ) . await ;
5555 let _: ( ) = client. request ( "flash_ingestBlock" , ( block_2, ) ) . await ?;
56-
5756 } else {
5857 println ! ( "📦 Simulating Standard Block #{}" , block_number) ;
5958 let block = create_mock_block ( block_number, hash_1) ;
@@ -68,18 +67,11 @@ async fn main() -> Result<()> {
6867}
6968
7069fn create_mock_block ( number : u64 , hash : H256 ) -> Block < H256 > {
71- let mut block = Block :: default ( ) ;
72- block. number = Some ( number. into ( ) ) ;
73- block. hash = Some ( hash) ;
74- block. parent_hash = H256 :: random ( ) ;
75- block. timestamp = U256 :: from ( chrono:: Utc :: now ( ) . timestamp ( ) ) ;
76-
77- // Add some mock transactions if needed
78- let mut tx = Transaction :: default ( ) ;
79- tx. hash = H256 :: random ( ) ;
80- tx. from = Address :: random ( ) ;
81- tx. nonce = U256 :: from ( 0 ) ;
82- // block.transactions.push(tx); // Block<H256> only has hashes by default
83-
84- block
70+ Block {
71+ number : Some ( number. into ( ) ) ,
72+ hash : Some ( hash) ,
73+ parent_hash : H256 :: random ( ) ,
74+ timestamp : U256 :: from ( chrono:: Utc :: now ( ) . timestamp ( ) ) ,
75+ ..Default :: default ( )
76+ }
8577}
0 commit comments