File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -188,14 +188,14 @@ impl OpenBlock {
188188 pub fn execute_transactions (
189189 & mut self ,
190190 block_executor : & dyn BlockExecutor ,
191- mut transactions : Vec < Transaction > ,
191+ transactions : Vec < Transaction > ,
192192 ) -> Result < ( ) , Error > {
193193 let execution_id = self . execution_id . expect ( "Txs can be executed only after opening a block" ) ;
194194 // TODO: Handle erroneous transactions
195195 let transaction_results = block_executor
196196 . execute_transactions ( execution_id, self . inner_mut ( ) . state_mut ( ) , & transactions)
197197 . map_err ( |_| Error :: Other ( String :: from ( "Rejected while executing transactions" ) ) ) ?;
198- self . block . transactions . append ( & mut transactions) ;
198+ self . block . transactions . append ( & mut transactions. clone ( ) ) ;
199199 // TODO: How to do this without copy?
200200 let mut tx_events: HashMap < TxHash , Vec < Event > > = HashMap :: new ( ) ;
201201 for ( tx, result) in transactions. into_iter ( ) . zip ( transaction_results. into_iter ( ) ) {
Original file line number Diff line number Diff line change 1919
2020extern crate foundry_integration_test as test_common;
2121
22+ use ckey:: { Ed25519KeyPair , Generator , KeyPairTrait , Random } ;
2223use std:: time:: Duration ;
2324use test_common:: * ;
2425use tokio:: time:: delay_for;
@@ -97,3 +98,21 @@ async fn track_blocks() {
9798 }
9899 panic ! ( "Failed to sync 4 nodes" )
99100}
101+
102+ #[ actix_rt:: test]
103+ async fn events_stored_in_every_nodes ( ) {
104+ let _node: Vec < FoundryNode > = ( 0 ..4 ) . into_iter ( ) . map ( |i| run_node_override ( simple_multi_node ( i) ) ) . collect ( ) ;
105+ delay_for ( Duration :: from_secs ( 3 ) ) . await ;
106+
107+ let user: Ed25519KeyPair = Random . generate ( ) . unwrap ( ) ;
108+
109+ let tx = create_tx_hello ( GRAPHQL_PORT_BASE , user. public ( ) , user. private ( ) , 0 ) . await ;
110+ send_tx ( GRAPHQL_PORT_BASE , tx. tx_type ( ) , tx. body ( ) ) . await . unwrap ( ) ;
111+
112+ delay_for ( Duration :: from_secs ( 4 ) ) . await ;
113+
114+ for i in 0 ..4 {
115+ let result = get_event ( GRAPHQL_PORT_BASE + i, * tx. hash ( ) ) . await ;
116+ assert_eq ! ( 1 , result. len( ) ) ;
117+ }
118+ }
You can’t perform that action at this time.
0 commit comments