Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 76ecbcc

Browse files
zilm13mkalinin
authored andcommitted
Reduce BlockBodies download memory usage
1 parent 7b38902 commit 76ecbcc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ethereumj-core/src/main/java/org/ethereum/net/eth/message/BlockBodiesMessage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public BlockBodiesMessage(List<byte[]> blockBodies) {
4949
private synchronized void parse() {
5050
if (parsed) return;
5151
RLPList paramsList = (RLPList) RLP.decode2(encoded).get(0);
52+
this.encoded = null;
5253

5354
blockBodies = new ArrayList<>();
5455
for (int i = 0; i < paramsList.size(); ++i) {

ethereumj-core/src/main/java/org/ethereum/sync/BlockDownloader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ public void onFailure(Throwable t) {
292292
}
293293
}
294294
receivedBlocksLatch = new CountDownLatch(max(reqBlocksCounter - 2, 1));
295+
receivedBlocksLatch.await(1000, TimeUnit.MILLISECONDS);
295296
} else {
296297
logger.debug("{} blockRetrieveLoop: BlockQueue is full", name);
297-
receivedBlocksLatch = new CountDownLatch(1);
298+
Thread.sleep(200);
298299
}
299-
receivedBlocksLatch.await(200, TimeUnit.MILLISECONDS);
300300
} catch (InterruptedException e) {
301301
break;
302302
} catch (Exception e) {

0 commit comments

Comments
 (0)