@@ -192,15 +192,8 @@ public void executeTest() {
192192 Fork currentFork = nextFork ;
193193 Iterator <Transaction > txs = transactions .iterator ();
194194 Boolean txHasNext = txs .hasNext ();
195-
196- int numberOfLeadingEmptyBlocks = 0 ;
197- for (Transaction tx : transactions ) {
198- if (tx != null ) {
199- break ;
200- }
201- numberOfLeadingEmptyBlocks ++;
202- }
203- boolean allTransactionsAreNull = (numberOfLeadingEmptyBlocks == transactions .size ());
195+ long firstBlockNumber = 0 ;
196+ long finalBlockNumber = 0 ;
204197
205198 while (txHasNext ) {
206199 // Send transaction to the transaction pool with eth_sendRawTransaction
@@ -216,10 +209,12 @@ public void executeTest() {
216209 } else {
217210 // Send all transactions in the same block
218211 while (txHasNext ) {
219- String txHash =
220- besuNode .execute (
221- ethTransactions .sendRawTransaction (txs .next ().encoded ().toHexString ()));
222- txHashes .add (txHash );
212+ final Transaction tx = txs .next ();
213+ if (tx != null ) {
214+ String txHash =
215+ besuNode .execute (ethTransactions .sendRawTransaction (tx .encoded ().toHexString ()));
216+ txHashes .add (txHash );
217+ }
223218 txHasNext = txs .hasNext ();
224219 }
225220 }
@@ -237,10 +232,19 @@ public void executeTest() {
237232 currentFork = nextFork ;
238233
239234 // We trace the conflation
240- checkState (blockNumbers .isEmpty () == allTransactionsAreNull );
241- long firstBlockNumber = blockNumbers .isEmpty () ? 1 : Collections .min (blockNumbers );
242- long finalBlockNumber =
243- blockNumbers .isEmpty () ? transactions .size () : Collections .max (blockNumbers );
235+ // For now conflations are composed of a single block triggered by
236+ // callEngineAPIToBuildNewBlock
237+ Block blockInfoUpdated = this .besuNode .execute (ethTransactions .block ());
238+ checkState (blockNumbers .isEmpty () == blockInfoUpdated .getTransactions ().isEmpty ());
239+ if (blockNumbers .isEmpty ()) {
240+ // If the block has no transactions, we retrieve the block numbers to trace from the last
241+ // traced until the latest block
242+ firstBlockNumber = finalBlockNumber + 1 ;
243+ finalBlockNumber = blockInfoUpdated .getNumber ().longValue ();
244+ } else {
245+ firstBlockNumber = Collections .min (blockNumbers );
246+ finalBlockNumber = Collections .max (blockNumbers );
247+ }
244248 TraceFile traceFile = traceAndCheckTracer (firstBlockNumber , finalBlockNumber , currentFork );
245249 Path traceFilePath = Path .of (traceFile .conflatedTracesFileName ());
246250
0 commit comments