@@ -28,7 +28,7 @@ use bytes::Bytes;
2828use ethereum_types:: { H256 , H512 } ;
2929use fastmap:: H256FastSet ;
3030use network:: { Error , ErrorKind , PeerId , client_version:: ClientCapabilities } ;
31- use rand:: RngCore ;
31+ use rand:: { seq :: IteratorRandom , RngCore } ;
3232use rlp:: RlpStream ;
3333
3434use crate :: chain:: propagator_statistics:: SyncPropagatorStatistics ;
@@ -44,6 +44,8 @@ use std::sync::Arc;
4444
4545const NEW_POOLED_HASHES_LIMIT : usize = 4096 ;
4646
47+ const MAX_TRACE_PROPAGATED_TXS : usize = 20 ;
48+
4749/// The Chain Sync Propagator: propagates data to peers
4850// pub struct SyncPropagator<'a> {
4951
@@ -193,8 +195,9 @@ impl ChainSync {
193195 . retain_pending ( & all_transactions_hashes) ;
194196 }
195197
196- debug ! ( target: "sync" , "Propagating {:?}" , all_transactions_hashes) ;
197- trace ! ( target: "sync" , "Propagating {} transactions to {} peers" , transactions. len( ) , peers. len( ) ) ;
198+
199+ debug ! ( target: "sync" , "Propagating {} transactions to {} peers" , transactions. len( ) , peers. len( ) ) ;
200+ trace ! ( target: "sync" , "Propagating {:?}" , if all_transactions_hashes. len( ) > MAX_TRACE_PROPAGATED_TXS { all_transactions_hashes. iter( ) . choose_multiple( & mut rand:: thread_rng( ) , MAX_TRACE_PROPAGATED_TXS ) . iter( ) . collect( ) } else { all_transactions_hashes } ) ;
198201
199202 let send_packet = |io : & mut dyn SyncIo ,
200203 stats : & mut SyncPropagatorStatistics ,
0 commit comments