forked from Qortal/qortal
Limit to 10 untrimmed blocks per response, as they are larger than the trimmed ones.
This commit is contained in:
parent
cffbd41f26
commit
c63a7884cb
@ -1345,6 +1345,10 @@ public class Controller extends Thread {
|
|||||||
BlockData blockData = repository.getBlockRepository().fromReference(parentSignature);
|
BlockData blockData = repository.getBlockRepository().fromReference(parentSignature);
|
||||||
|
|
||||||
while (blockData != null && blocks.size() < numberRequested) {
|
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);
|
Block block = new Block(repository, blockData);
|
||||||
blocks.add(block);
|
blocks.add(block);
|
||||||
blockData = repository.getBlockRepository().fromReference(blockData.getSignature());
|
blockData = repository.getBlockRepository().fromReference(blockData.getSignature());
|
||||||
|
@ -141,6 +141,8 @@ public class Settings {
|
|||||||
private int maxBlocksPerRequest = 100;
|
private int maxBlocksPerRequest = 100;
|
||||||
/** Maximum number of blocks this node will serve in a single response */
|
/** Maximum number of blocks this node will serve in a single response */
|
||||||
private int maxBlocksPerResponse = 100;
|
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
|
// Which blockchains this node is running
|
||||||
private String blockchainConfig = null; // use default from resources
|
private String blockchainConfig = null; // use default from resources
|
||||||
@ -474,6 +476,8 @@ public class Settings {
|
|||||||
|
|
||||||
public int getMaxBlocksPerResponse() { return this.maxBlocksPerResponse; }
|
public int getMaxBlocksPerResponse() { return this.maxBlocksPerResponse; }
|
||||||
|
|
||||||
|
public int getMaxUntrimmedBlocksPerResponse() { return this.maxUntrimmedBlocksPerResponse; }
|
||||||
|
|
||||||
public boolean isAutoUpdateEnabled() {
|
public boolean isAutoUpdateEnabled() {
|
||||||
return this.autoUpdateEnabled;
|
return this.autoUpdateEnabled;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user