Skip to content

Commit 612a011

Browse files
thinkAfCodGrapeBaBa
authored andcommitted
revert
1 parent 6d02b0d commit 612a011

File tree

2 files changed

+18
-55
lines changed

2 files changed

+18
-55
lines changed

hildr-node/src/main/java/io/optimism/l1/BeaconBlobFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public List<BlobSidecar> getBlobSidecards(String blockId, final List<BigInteger>
141141
: Map.of("indices", indices.stream().map(BigInteger::toString).collect(Collectors.joining(",")));
142142
var postfix = "%s%s".formatted(blockId, prepareQueryParams(params));
143143
var res = getBlobSidecars("%s/%s".formatted(this.sidecarsMethod, postfix));
144-
if (res.getData() != null && !res.getData().isEmpty()) {
144+
if (res != null && res.getData() != null && !res.getData().isEmpty()) {
145145
return res.getData();
146146
}
147147
if (this.archiverSidecarsMethod != null) {

hildr-node/src/main/java/io/optimism/l1/InnerWatcher.java

Lines changed: 17 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@
1818
import io.optimism.utilities.rpc.Web3jProvider;
1919
import io.optimism.utilities.telemetry.Logging;
2020
import io.optimism.utilities.telemetry.TracerTaskWrapper;
21-
import io.reactivex.BackpressureStrategy;
22-
import io.reactivex.Flowable;
2321
import io.reactivex.disposables.Disposable;
2422
import java.math.BigInteger;
2523
import java.time.Duration;
2624
import java.util.*;
2725
import java.util.concurrent.ExecutionException;
28-
import java.util.concurrent.ScheduledThreadPoolExecutor;
2926
import java.util.concurrent.StructuredTaskScope;
30-
import java.util.concurrent.TimeUnit;
3127
import java.util.stream.Collectors;
3228
import org.apache.commons.collections4.CollectionUtils;
3329
import org.apache.commons.lang3.StringUtils;
@@ -159,8 +155,6 @@ public class InnerWatcher extends AbstractExecutionThreadService {
159155

160156
private boolean devnet = false;
161157

162-
private ScheduledThreadPoolExecutor scheduledExecutorService;
163-
164158
/**
165159
* create a InnerWatcher instance.
166160
*
@@ -219,51 +213,23 @@ private void getMetadataFromL2(BigInteger l2StartBlock) {
219213
}
220214
}
221215

222-
private Disposable subscribeL1NewHeads() {
223-
if (this.wsProvider != null) {
224-
this.l1HeadListener = this.wsProvider
225-
.newHeadsNotifications()
226-
.subscribe(
227-
notification -> {
228-
NewHead header = notification.getParams().getResult();
229-
String hash = header.getHash();
230-
BigInteger number = Numeric.toBigInt(header.getNumber());
231-
String parentHash = header.getParentHash();
232-
BigInteger time = Numeric.toBigInt(header.getTimestamp());
233-
l1Head = new BlockInfo(hash, number, parentHash, time);
234-
},
235-
t -> {
236-
if (t instanceof WebsocketNotConnectedException) {
237-
this.subscribeL1NewHeads();
238-
}
239-
});
240-
} else {
241-
this.scheduledExecutorService = new ScheduledThreadPoolExecutor(1);
242-
this.l1HeadListener = Flowable.create(
243-
(subscriber) -> {
244-
this.scheduledExecutorService.scheduleAtFixedRate(
245-
() -> {
246-
EthBlock.Block block = null;
247-
try {
248-
block = pollBlock(
249-
this.provider, DefaultBlockParameterName.LATEST, false);
250-
} catch (ExecutionException | InterruptedException e) {
251-
LOGGER.warn("error while fetching L1 data for block", e);
252-
}
253-
subscriber.onNext(block);
254-
},
255-
0,
256-
12,
257-
TimeUnit.SECONDS);
258-
},
259-
BackpressureStrategy.BUFFER)
260-
.subscribe(notification -> {
261-
EthBlock.Block block = (EthBlock.Block) notification;
262-
l1Head = BlockInfo.from(block);
263-
});
264-
}
265-
266-
return this.l1HeadListener;
216+
private void subscribeL1NewHeads() {
217+
this.l1HeadListener = this.wsProvider
218+
.newHeadsNotifications()
219+
.subscribe(
220+
notification -> {
221+
NewHead header = notification.getParams().getResult();
222+
String hash = header.getHash();
223+
BigInteger number = Numeric.toBigInt(header.getNumber());
224+
String parentHash = header.getParentHash();
225+
BigInteger time = Numeric.toBigInt(header.getTimestamp());
226+
l1Head = new BlockInfo(hash, number, parentHash, time);
227+
},
228+
t -> {
229+
if (t instanceof WebsocketNotConnectedException) {
230+
this.subscribeL1NewHeads();
231+
}
232+
});
267233
}
268234

269235
/**
@@ -654,9 +620,6 @@ protected void shutDown() {
654620
if (this.wsProvider != null) {
655621
this.wsProvider.shutdown();
656622
}
657-
if (this.scheduledExecutorService != null) {
658-
this.scheduledExecutorService.shutdown();
659-
}
660623
}
661624

662625
@Override

0 commit comments

Comments
 (0)