@@ -125,6 +125,88 @@ 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, e
151+ ) ;
152+ }
153+ }
154+ }
155+
156+ for data_tx in transactions. all_data_txs ( ) {
157+ if let Err ( e) = self . ingest_validated_data_tx ( data_tx. clone ( ) ) . await {
158+ if !matches ! ( e, crate :: mempool_service:: TxIngressError :: Skipped ) {
159+ warn ! ( "Failed to ingest validated data tx {}: {:?}" , data_tx. id, e) ;
160+ }
161+ }
162+ }
163+
164+ Ok ( ( ) )
165+ }
166+
167+ /// Ingest a block-validated commitment tx, bypassing balance checks.
168+ #[ instrument( skip_all, fields( tx. id = %tx. id) ) ]
169+ async fn ingest_validated_commitment_tx (
170+ & self ,
171+ tx : CommitmentTransaction ,
172+ ) -> Result < ( ) , crate :: mempool_service:: TxIngressError > {
173+ if self
174+ . mempool_state
175+ . is_known_commitment_in_mempool ( & tx. id , tx. signer )
176+ . await
177+ {
178+ return Err ( crate :: mempool_service:: TxIngressError :: Skipped ) ;
179+ }
180+
181+ self . mempool_state
182+ . insert_commitment_and_mark_valid ( & tx)
183+ . await ?;
184+
185+ debug ! ( "Ingested validated commitment tx {}" , tx. id) ;
186+ Ok ( ( ) )
187+ }
188+
189+ /// Ingest a block-validated data tx, bypassing balance/EMA checks.
190+ #[ instrument( skip_all, fields( tx. id = %tx. id) ) ]
191+ async fn ingest_validated_data_tx (
192+ & self ,
193+ tx : irys_types:: DataTransactionHeader ,
194+ ) -> Result < ( ) , crate :: mempool_service:: TxIngressError > {
195+ if self
196+ . mempool_state
197+ . valid_submit_ledger_tx_cloned ( & tx. id )
198+ . await
199+ . is_some ( )
200+ {
201+ return Err ( crate :: mempool_service:: TxIngressError :: Skipped ) ;
202+ }
203+
204+ self . mempool_state . bounded_insert_data_tx ( tx. clone ( ) ) . await ;
205+
206+ debug ! ( "Ingested validated data tx {}" , tx. id) ;
207+ Ok ( ( ) )
208+ }
209+
128210 #[ tracing:: instrument( level = "trace" , skip_all, fields( fork_parent. height = event. fork_parent. height) ) ]
129211 pub async fn handle_reorg ( & self , event : ReorgEvent ) -> eyre:: Result < ( ) > {
130212 tracing:: debug!(
0 commit comments