Skip to content

Commit

Permalink
Allow to configure the memory pool capacity (#948)
Browse files Browse the repository at this point in the history
Making memory pool capacity configurable
  • Loading branch information
shargon authored and lock9 committed Jul 23, 2019
1 parent d048805 commit abda789
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions neo/Ledger/Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public class FillCompleted { }
Transactions = new[] { DeployNativeContracts() }
};

private const int MemoryPoolMaxTransactions = 50_000;
private const int MaxTxToReverifyPerIdle = 10;
private static readonly object lockObj = new object();
private readonly NeoSystem system;
Expand Down Expand Up @@ -89,7 +88,7 @@ static Blockchain()
public Blockchain(NeoSystem system, Store store)
{
this.system = system;
this.MemPool = new MemoryPool(system, MemoryPoolMaxTransactions);
this.MemPool = new MemoryPool(system, ProtocolSettings.Default.MemoryPoolMaxTransactions);
this.Store = store;
lock (lockObj)
{
Expand Down
3 changes: 3 additions & 0 deletions neo/ProtocolSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Linq;
using System.Threading;

Expand All @@ -11,6 +12,7 @@ public class ProtocolSettings
public string[] StandbyValidators { get; }
public string[] SeedList { get; }
public uint MillisecondsPerBlock { get; }
public int MemoryPoolMaxTransactions { get; }

static ProtocolSettings _default;

Expand Down Expand Up @@ -70,6 +72,7 @@ private ProtocolSettings(IConfigurationSection section)
"seed5.neo.org:10333"
};
this.MillisecondsPerBlock = section.GetValue("SecondsPerBlock", 15000u);
this.MemoryPoolMaxTransactions = Math.Max(1, section.GetValue("MemoryPoolMaxTransactions", 50_000));
}
}
}

0 comments on commit abda789

Please sign in to comment.