Skip to content

Commit

Permalink
fix: init l2 refs
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod authored and GrapeBaBa committed Feb 10, 2024
1 parent 2ab153b commit 6bd2d15
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions hildr-node/src/main/java/io/optimism/derive/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.optimism.common.Epoch;
import io.optimism.config.Config;
import io.optimism.driver.HeadInfo;
import io.optimism.driver.L1AttributesDepositedTxNotFoundException;
import io.optimism.l1.L1Info;
import java.math.BigInteger;
import java.util.Map.Entry;
Expand Down Expand Up @@ -142,7 +143,7 @@ public Tuple2<BlockInfo, Epoch> l2Info(BigInteger timestamp) {
if (cache != null) {
return cache;
}

LOGGER.warn("L2 refs cache not contains, will fetch from geth: blockNum = {}", blockNum);
var res = l2Fetcher.apply(blockNum);
this.l2Refs.put(res.component1().number(), res);
return res;
Expand Down Expand Up @@ -337,10 +338,14 @@ public static TreeMap<BigInteger, Tuple2<BlockInfo, Epoch>> initL2Refs(
if (block == null) {
continue;
}
final HeadInfo l2BlockInfo = HeadInfo.from(block);
l2Refs.put(
l2BlockInfo.l2BlockInfo().number(),
new Tuple2<>(l2BlockInfo.l2BlockInfo(), l2BlockInfo.l1Epoch()));
try {
final HeadInfo l2BlockInfo = HeadInfo.from(block);
l2Refs.put(
l2BlockInfo.l2BlockInfo().number(),
new Tuple2<>(l2BlockInfo.l2BlockInfo(), l2BlockInfo.l1Epoch()));
} catch (L1AttributesDepositedTxNotFoundException ignore) {
LOGGER.debug("Can't found deposited transaction (at blockNum = %d)".formatted(i));
}
}
}
return l2Refs;
Expand Down

0 comments on commit 6bd2d15

Please sign in to comment.