@@ -125,6 +125,89 @@ impl Inner {
125125 Ok ( ( ) )
126126 }
127127
128+ /// Ingests validated block transactions into mempool, bypassing gossip-path balance checks.
129+ #[ instrument( skip_all, fields( block. hash = %block. block_hash, block. height = block. height) ) ]
130+ pub async fn handle_block_transactions_validated (
131+ & self ,
132+ block : Arc < IrysBlockHeader > ,
133+ transactions : Arc < crate :: block_discovery:: BlockTransactions > ,
134+ ) -> Result < ( ) , crate :: mempool_service:: TxIngressError > {
135+ debug ! (
136+ "Ingesting {} commitment txs, {} data txs from validated block {}" ,
137+ transactions. commitment_txs. len( ) ,
138+ transactions. all_data_txs( ) . count( ) ,
139+ block. block_hash
140+ ) ;
141+
142+ for commitment_tx in & transactions. commitment_txs {
143+ if let Err ( e) = self
144+ . ingest_validated_commitment_tx ( commitment_tx. clone ( ) )
145+ . await
146+ {
147+ if !matches ! ( e, crate :: mempool_service:: TxIngressError :: Skipped ) {
148+ warn ! (
149+ "Failed to ingest validated commitment tx {}: {:?}" ,
150+ commitment_tx. id( ) ,
151+ e
152+ ) ;
153+ }
154+ }
155+ }
156+
157+ for data_tx in transactions. all_data_txs ( ) {
158+ if let Err ( e) = self . ingest_validated_data_tx ( data_tx. clone ( ) ) . await {
159+ if !matches ! ( e, crate :: mempool_service:: TxIngressError :: Skipped ) {
160+ warn ! ( "Failed to ingest validated data tx {}: {:?}" , data_tx. id, e) ;
161+ }
162+ }
163+ }
164+
165+ Ok ( ( ) )
166+ }
167+
168+ /// Ingest a block-validated commitment tx, bypassing balance checks.
169+ #[ instrument( skip_all, fields( tx. id = %tx. id( ) ) ) ]
170+ async fn ingest_validated_commitment_tx (
171+ & self ,
172+ tx : CommitmentTransaction ,
173+ ) -> Result < ( ) , crate :: mempool_service:: TxIngressError > {
174+ if self
175+ . mempool_state
176+ . is_known_commitment_in_mempool ( & tx. id ( ) , tx. signer ( ) )
177+ . await
178+ {
179+ return Err ( crate :: mempool_service:: TxIngressError :: Skipped ) ;
180+ }
181+
182+ self . mempool_state
183+ . insert_commitment_and_mark_valid ( & tx)
184+ . await ?;
185+
186+ debug ! ( "Ingested validated commitment tx {}" , tx. id( ) ) ;
187+ Ok ( ( ) )
188+ }
189+
190+ /// Ingest a block-validated data tx, bypassing balance/EMA checks.
191+ #[ instrument( skip_all, fields( tx. id = %tx. id) ) ]
192+ async fn ingest_validated_data_tx (
193+ & self ,
194+ tx : irys_types:: DataTransactionHeader ,
195+ ) -> Result < ( ) , crate :: mempool_service:: TxIngressError > {
196+ if self
197+ . mempool_state
198+ . valid_submit_ledger_tx_cloned ( & tx. id )
199+ . await
200+ . is_some ( )
201+ {
202+ return Err ( crate :: mempool_service:: TxIngressError :: Skipped ) ;
203+ }
204+
205+ self . mempool_state . bounded_insert_data_tx ( tx. clone ( ) ) . await ;
206+
207+ debug ! ( "Ingested validated data tx {}" , tx. id) ;
208+ Ok ( ( ) )
209+ }
210+
128211 #[ tracing:: instrument( level = "trace" , skip_all, fields( fork_parent. height = event. fork_parent. height) ) ]
129212 pub async fn handle_reorg ( & self , event : ReorgEvent ) -> eyre:: Result < ( ) > {
130213 tracing:: debug!(
0 commit comments