Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions hildr-node/src/main/java/io/optimism/l1/ChainWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
@SuppressWarnings({"UnusedVariable", "preview"})
public class ChainWatcher {

private MessagePassingQueue<BlockUpdate> blockUpdateQueue;
private final InnerWatcher innerWatcher;
private volatile MessagePassingQueue<BlockUpdate> blockUpdateQueue;
private volatile InnerWatcher innerWatcher;
private final Config config;

/**
* Gets block update queue.
Expand All @@ -51,10 +52,11 @@ public MessagePassingQueue<BlockUpdate> getBlockUpdateQueue() {
* @param config the global config
*/
public ChainWatcher(BigInteger l1StartBlock, BigInteger l2StartBlock, Config config) {
this.config = config;
this.blockUpdateQueue = new MpscGrowableArrayQueue<>(1024 * 4, 1024 * 64);
this.innerWatcher =
new InnerWatcher(
config,
this.config,
this.blockUpdateQueue,
l1StartBlock,
l2StartBlock,
Expand All @@ -75,8 +77,19 @@ public void stop() {
/**
* Restart.
*
* @param number the number
* @param number1 the number 1
* @param l1StartBlock new l1 start block number
* @param l2StartBlock new l2 start block number
*/
public void restart(BigInteger number, BigInteger number1) {}
public void restart(BigInteger l1StartBlock, BigInteger l2StartBlock) {
this.stop();
this.blockUpdateQueue = new MpscGrowableArrayQueue<>(1024 * 4, 1024 * 64);
this.innerWatcher =
new InnerWatcher(
this.config,
this.blockUpdateQueue,
l1StartBlock,
l2StartBlock,
Executors.newVirtualThreadPerTaskExecutor());
this.start();
}
}
Loading