Skip to content

Commit

Permalink
break and return are different ...
Browse files Browse the repository at this point in the history
Signed-off-by: Francois Bojarski <[email protected]>
  • Loading branch information
letypequividelespoubelles committed Sep 20, 2024
1 parent 2437fe1 commit e73ea89
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,30 @@ public List<ColumnHeader> columnsHeaders() {

@Override
public void commit(List<MappedByteBuffer> buffers) {
final Trace trace = new Trace(buffers);

final long firstBlockNumber = operations.getFirst().absoluteBlockNumber();
final long chainId = getChainIdFromConflation();
int relblock = 0;
for (BlockdataOperation blockData : operations) {
blockData.trace(trace, ++relblock, firstBlockNumber, chainId);
}
}

private long getChainIdFromConflation() {
// TODO: this doesn't work if all transaction of the batch are WO ChainId
long chainId = -1;
for (RlpTxnOperation tx : rlpTxn.operations().getAll()) {
try {
chainId = getChainIdFromTransaction(tx.tx());
return;
break;
} catch (Exception e) {
continue;
}
}
if (chainId == -1) {
throw new RuntimeException("No chainId found in the batch");
}

final Trace trace = new Trace(buffers);
int relblock = 0;
for (BlockdataOperation blockData : this.operations) {
relblock += 1;
blockData.trace(trace, relblock, firstBlockNumber, chainId);
}
return chainId;
}
}

0 comments on commit e73ea89

Please sign in to comment.