mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Reduce getDataResponse size from 9 MB to 6 MB
Reduce number of blocks at GetBlocksResponse from 4000 to 3000 Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
98349a2961
commit
6aad3a8dc5
2 changed files with 3 additions and 3 deletions
|
@ -91,8 +91,8 @@ class GetBlocksRequestHandler {
|
||||||
|
|
||||||
public void onGetBlocksRequest(GetBlocksRequest getBlocksRequest, Connection connection) {
|
public void onGetBlocksRequest(GetBlocksRequest getBlocksRequest, Connection connection) {
|
||||||
long ts = System.currentTimeMillis();
|
long ts = System.currentTimeMillis();
|
||||||
// We limit number of blocks to 4000 which is about 1 month.
|
// We limit number of blocks to 3000 which is about 3 weeks.
|
||||||
List<Block> blocks = new LinkedList<>(daoStateService.getBlocksFromBlockHeight(getBlocksRequest.getFromBlockHeight(), 4000));
|
List<Block> blocks = new LinkedList<>(daoStateService.getBlocksFromBlockHeight(getBlocksRequest.getFromBlockHeight(), 3000));
|
||||||
List<RawBlock> rawBlocks = blocks.stream().map(RawBlock::fromBlock).collect(Collectors.toList());
|
List<RawBlock> rawBlocks = blocks.stream().map(RawBlock::fromBlock).collect(Collectors.toList());
|
||||||
GetBlocksResponse getBlocksResponse = new GetBlocksResponse(rawBlocks, getBlocksRequest.getNonce());
|
GetBlocksResponse getBlocksResponse = new GetBlocksResponse(rawBlocks, getBlocksRequest.getNonce());
|
||||||
log.info("Received GetBlocksRequest from {} for blocks from height {}. " +
|
log.info("Received GetBlocksRequest from {} for blocks from height {}. " +
|
||||||
|
|
|
@ -312,7 +312,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
|
||||||
Map<ByteArray, PersistableNetworkPayload> mapForDataResponse = getMapForDataResponse(getDataRequest.getVersion());
|
Map<ByteArray, PersistableNetworkPayload> mapForDataResponse = getMapForDataResponse(getDataRequest.getVersion());
|
||||||
|
|
||||||
// Give a bit of tolerance for message overhead
|
// 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
|
// 25% of space is allocated for PersistableNetworkPayloads
|
||||||
long limit = Math.round(maxSize * 0.25);
|
long limit = Math.round(maxSize * 0.25);
|
||||||
|
|
Loading…
Add table
Reference in a new issue