@@ -150,6 +150,7 @@ where
150150 self . peer_information . clone ( ) ,
151151 r,
152152 self . blockchain_read_handle . clone ( ) ,
153+ self . blockchain_context_service . clone ( ) ,
153154 self . txpool_read_handle . clone ( ) ,
154155 )
155156 . boxed ( ) ,
@@ -298,9 +299,9 @@ async fn new_fluffy_block<A: NetZoneAddress>(
298299 peer_information : PeerInformation < A > ,
299300 request : NewFluffyBlock ,
300301 mut blockchain_read_handle : BlockchainReadHandle ,
302+ mut blockchain_context_service : BlockchainContextService ,
301303 mut txpool_read_handle : TxpoolReadHandle ,
302304) -> anyhow:: Result < ProtocolResponse > {
303- // TODO: check context service here and ignore the block?
304305 let current_blockchain_height = request. current_blockchain_height ;
305306
306307 peer_information
@@ -337,6 +338,16 @@ async fn new_fluffy_block<A: NetZoneAddress>(
337338 } )
338339 . await ?;
339340
341+ let context = blockchain_context_service. blockchain_context ( ) ;
342+ if block. number ( ) + 10 < context. chain_height {
343+ tracing:: debug!(
344+ our_height = context. chain_height,
345+ block_height = block. number( ) ,
346+ "fluffy block too old, ignoring."
347+ ) ;
348+ return Ok ( ProtocolResponse :: NA ) ;
349+ }
350+
340351 let res = blockchain_interface:: handle_incoming_block (
341352 block,
342353 txs,
0 commit comments