Browse Source

Limit to 10 untrimmed blocks per response, as they are larger than the trimmed ones.

sync-multiple-blocks
CalDescent 3 years ago
parent
commit
c63a7884cb
  1. 4
      src/main/java/org/qortal/controller/Controller.java
  2. 4
      src/main/java/org/qortal/settings/Settings.java

4
src/main/java/org/qortal/controller/Controller.java

@ -1345,6 +1345,10 @@ public class Controller extends Thread {
BlockData blockData = repository.getBlockRepository().fromReference(parentSignature);
while (blockData != null && blocks.size() < numberRequested) {
// If we're dealing with untrimmed blocks, ensure we don't go above the untrimmedBlockLimitPerRequest
if (blockData.isTrimmed() == false && blocks.size() >= untrimmedBlockLimitPerRequest) {
break;
}
Block block = new Block(repository, blockData);
blocks.add(block);
blockData = repository.getBlockRepository().fromReference(blockData.getSignature());

4
src/main/java/org/qortal/settings/Settings.java

@ -141,6 +141,8 @@ public class Settings {
private int maxBlocksPerRequest = 100;
/** Maximum number of blocks this node will serve in a single response */
private int maxBlocksPerResponse = 100;
/** Maximum number of untrimmed blocks this node will serve in a single response */
private int maxUntrimmedBlocksPerResponse = 10;
// Which blockchains this node is running
private String blockchainConfig = null; // use default from resources
@ -474,6 +476,8 @@ public class Settings {
public int getMaxBlocksPerResponse() { return this.maxBlocksPerResponse; }
public int getMaxUntrimmedBlocksPerResponse() { return this.maxUntrimmedBlocksPerResponse; }
public boolean isAutoUpdateEnabled() {
return this.autoUpdateEnabled;
}

Loading…
Cancel
Save