Lower the max size of transaction packet to prevent going oversize. (#9308)
* Lower the max size of transaction packet to prevent going oversize. * Log RLP size.
This commit is contained in:
		
							parent
							
								
									1ac4676f4b
								
							
						
					
					
						commit
						29125e830b
					
				@ -148,7 +148,8 @@ const MAX_PEER_LAG_PROPAGATION: BlockNumber = 20;
 | 
			
		||||
const MAX_NEW_HASHES: usize = 64;
 | 
			
		||||
const MAX_NEW_BLOCK_AGE: BlockNumber = 20;
 | 
			
		||||
// maximal packet size with transactions (cannot be greater than 16MB - protocol limitation).
 | 
			
		||||
const MAX_TRANSACTION_PACKET_SIZE: usize = 8 * 1024 * 1024;
 | 
			
		||||
// keep it under 8MB as well, cause it seems that it may result oversized after compression.
 | 
			
		||||
const MAX_TRANSACTION_PACKET_SIZE: usize = 5 * 1024 * 1024;
 | 
			
		||||
// Min number of blocks to be behind for a snapshot sync
 | 
			
		||||
const SNAPSHOT_RESTORE_THRESHOLD: BlockNumber = 30000;
 | 
			
		||||
const SNAPSHOT_MIN_PEERS: usize = 3;
 | 
			
		||||
 | 
			
		||||
@ -237,8 +237,9 @@ impl SyncPropagator {
 | 
			
		||||
			let lucky_peers_len = lucky_peers.len();
 | 
			
		||||
			for (peer_id, sent, rlp) in lucky_peers {
 | 
			
		||||
				peers.insert(peer_id);
 | 
			
		||||
				let size = rlp.len();
 | 
			
		||||
				SyncPropagator::send_packet(io, peer_id, TRANSACTIONS_PACKET, rlp);
 | 
			
		||||
				trace!(target: "sync", "{:02} <- Transactions ({} entries)", peer_id, sent);
 | 
			
		||||
				trace!(target: "sync", "{:02} <- Transactions ({} entries; {} bytes)", peer_id, sent, size);
 | 
			
		||||
				max_sent = cmp::max(max_sent, sent);
 | 
			
		||||
			}
 | 
			
		||||
			debug!(target: "sync", "Sent up to {} transactions to {} peers.", max_sent, lucky_peers_len);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user