From 049caab89cf21d8a9a0777c146b3f36eb9a47d1e Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Fri, 16 Dec 2022 17:45:10 -0500 Subject: [PATCH] Reduce getDataResponse size from 9 MB to 6 MB Reduce number of blocks at GetBlocksResponse from 4000 to 3000 Signed-off-by: HenrikJannsen --- .../core/dao/node/full/network/GetBlocksRequestHandler.java | 4 ++-- .../main/java/bisq/network/p2p/storage/P2PDataStorage.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/bisq/core/dao/node/full/network/GetBlocksRequestHandler.java b/core/src/main/java/bisq/core/dao/node/full/network/GetBlocksRequestHandler.java index 98ce2db2399..a4b25b9bfa9 100644 --- a/core/src/main/java/bisq/core/dao/node/full/network/GetBlocksRequestHandler.java +++ b/core/src/main/java/bisq/core/dao/node/full/network/GetBlocksRequestHandler.java @@ -91,8 +91,8 @@ public GetBlocksRequestHandler(NetworkNode networkNode, DaoStateService daoState public void onGetBlocksRequest(GetBlocksRequest getBlocksRequest, Connection connection) { long ts = System.currentTimeMillis(); - // We limit number of blocks to 4000 which is about 1 month. - List blocks = new LinkedList<>(daoStateService.getBlocksFromBlockHeight(getBlocksRequest.getFromBlockHeight(), 4000)); + // We limit number of blocks to 3000 which is about 3 weeks. + List blocks = new LinkedList<>(daoStateService.getBlocksFromBlockHeight(getBlocksRequest.getFromBlockHeight(), 3000)); List rawBlocks = blocks.stream().map(RawBlock::fromBlock).collect(Collectors.toList()); GetBlocksResponse getBlocksResponse = new GetBlocksResponse(rawBlocks, getBlocksRequest.getNonce()); log.info("Received GetBlocksRequest from {} for blocks from height {}. " + diff --git a/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java b/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java index 5b9e46a41d1..023a231061e 100644 --- a/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java +++ b/p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java @@ -312,7 +312,7 @@ public GetDataResponse buildGetDataResponse( Map mapForDataResponse = getMapForDataResponse(getDataRequest.getVersion()); // Give a bit of tolerance for message overhead - double maxSize = Connection.getMaxPermittedMessageSize() * 0.9; + double maxSize = Connection.getMaxPermittedMessageSize() * 0.6; // 25% of space is allocated for PersistableNetworkPayloads long limit = Math.round(maxSize * 0.25);