@@ -156,7 +156,7 @@ struct SeenTransaction {
156156#[ derive( Default ) ]
157157struct NodeLeiosState {
158158 mempool : BTreeMap < TransactionId , SeenTransaction > ,
159- input_ids_from_ibs : HashSet < u64 > ,
159+ input_ids_in_flight : HashSet < u64 > ,
160160 ibs_to_generate : BTreeMap < u64 , Vec < u64 > > ,
161161 ibs : BTreeMap < InputBlockId , InputBlockState > ,
162162 ib_requests : BTreeMap < NodeId , PeerInputBlockRequests > ,
@@ -211,6 +211,14 @@ enum EndorserBlockState {
211211 finalized : bool ,
212212 } ,
213213}
214+ impl EndorserBlockState {
215+ fn eb ( & self ) -> Option < & EndorserBlock > {
216+ match self {
217+ Self :: Pending => None ,
218+ Self :: Received { eb, .. } => Some ( eb) ,
219+ }
220+ }
221+ }
214222
215223enum VoteBundleState {
216224 Requested ,
@@ -1105,9 +1113,9 @@ impl Node {
11051113 self . send_to ( * peer, SimulationMessage :: AnnounceTx ( id) ) ?;
11061114 }
11071115 if self . sim_config . mempool_aggressive_pruning
1108- && self . leios . input_ids_from_ibs . contains ( & tx. input_id )
1116+ && self . leios . input_ids_in_flight . contains ( & tx. input_id )
11091117 {
1110- // Ignoring a TX which conflicts with TXs we've seen in input blocks.
1118+ // Ignoring a TX which conflicts with TXs we've seen in input or endorser blocks.
11111119 // This only affects the Leios mempool; these TXs should still be able to reach the chain through Praos.
11121120 return Ok ( ( ) ) ;
11131121 }
@@ -1314,11 +1322,11 @@ impl Node {
13141322 if self . sim_config . mempool_aggressive_pruning {
13151323 // If we're using aggressive pruning, remove transactions from the mempool if they conflict with transactions in this IB
13161324 self . leios
1317- . input_ids_from_ibs
1325+ . input_ids_in_flight
13181326 . extend ( ib. transactions . iter ( ) . map ( |tx| tx. input_id ) ) ;
13191327 self . leios
13201328 . mempool
1321- . retain ( |_, seen| !self . leios . input_ids_from_ibs . contains ( & seen. tx . input_id ) ) ;
1329+ . retain ( |_, seen| !self . leios . input_ids_in_flight . contains ( & seen. tx . input_id ) ) ;
13221330 }
13231331 let header_seen = self
13241332 . leios
@@ -1442,13 +1450,11 @@ impl Node {
14421450
14431451 fn finish_validating_eb ( & mut self , from : NodeId , eb : Arc < EndorserBlock > ) -> Result < ( ) > {
14441452 let id = eb. id ( ) ;
1445- match self . leios . ebs . entry ( id) {
1446- Entry :: Vacant ( e) => {
1447- e. insert ( EndorserBlockState :: Received {
1448- eb,
1449- finalized : false ,
1450- } ) ;
1451- }
1453+ let eb_state = match self . leios . ebs . entry ( id) {
1454+ Entry :: Vacant ( e) => e. insert ( EndorserBlockState :: Received {
1455+ eb,
1456+ finalized : false ,
1457+ } ) ,
14521458 Entry :: Occupied ( mut e) => {
14531459 if matches ! ( e. get( ) , EndorserBlockState :: Received { .. } ) {
14541460 return Ok ( ( ) ) ;
@@ -1457,7 +1463,23 @@ impl Node {
14571463 eb,
14581464 finalized : false ,
14591465 } ) ;
1466+ e. into_mut ( )
14601467 }
1468+ } ;
1469+ let eb = eb_state. eb ( ) . unwrap ( ) ;
1470+ if self . sim_config . mempool_aggressive_pruning {
1471+ // If we're using aggressive pruning, remove transactions from the mempool if they conflict with transactions in this EB
1472+ self . leios
1473+ . input_ids_in_flight
1474+ . extend ( eb. txs . iter ( ) . filter_map ( |tx_id| {
1475+ let Some ( TransactionView :: Received ( tx) ) = self . txs . get ( tx_id) else {
1476+ return None ;
1477+ } ;
1478+ Some ( tx. input_id )
1479+ } ) ) ;
1480+ self . leios
1481+ . mempool
1482+ . retain ( |_, seen| !self . leios . input_ids_in_flight . contains ( & seen. tx . input_id ) ) ;
14611483 }
14621484 self . leios
14631485 . ebs_by_pipeline
0 commit comments