diff --git a/src/neo/Network/P2P/Payloads/Transaction.cs b/src/neo/Network/P2P/Payloads/Transaction.cs index 54860c6a86..fabb005c9a 100644 --- a/src/neo/Network/P2P/Payloads/Transaction.cs +++ b/src/neo/Network/P2P/Payloads/Transaction.cs @@ -19,7 +19,7 @@ namespace Neo.Network.P2P.Payloads public class Transaction : IEquatable, IInventory, IInteroperable { public const int MaxTransactionSize = 102400; - public const uint MaxValidUntilBlockIncrement = 2102400; + public const uint MaxValidUntilBlockIncrement = 5760; // 24 hour /// /// Maximum number of attributes that can be contained within a transaction /// diff --git a/src/neo/ProtocolSettings.cs b/src/neo/ProtocolSettings.cs index 7ac2f16273..a2673a35c3 100644 --- a/src/neo/ProtocolSettings.cs +++ b/src/neo/ProtocolSettings.cs @@ -15,6 +15,7 @@ public class ProtocolSettings public string[] SeedList { get; } public uint MillisecondsPerBlock { get; } public int MemoryPoolMaxTransactions { get; } + public uint MaxTraceableBlocks { get; } static ProtocolSettings _default; @@ -94,6 +95,7 @@ private ProtocolSettings(IConfigurationSection section) }; this.MillisecondsPerBlock = section.GetValue("MillisecondsPerBlock", 15000u); this.MemoryPoolMaxTransactions = Math.Max(1, section.GetValue("MemoryPoolMaxTransactions", 50_000)); + this.MaxTraceableBlocks = section.GetValue("MaxTraceableBlocks", 2_102_400u);// 365 days } } } diff --git a/src/neo/SmartContract/ApplicationEngine.Blockchain.cs b/src/neo/SmartContract/ApplicationEngine.Blockchain.cs index dad192c29f..191a2322e7 100644 --- a/src/neo/SmartContract/ApplicationEngine.Blockchain.cs +++ b/src/neo/SmartContract/ApplicationEngine.Blockchain.cs @@ -8,8 +8,6 @@ namespace Neo.SmartContract { partial class ApplicationEngine { - public const uint MaxTraceableBlocks = Transaction.MaxValidUntilBlockIncrement; - public static readonly InteropDescriptor System_Blockchain_GetHeight = Register("System.Blockchain.GetHeight", nameof(GetBlockchainHeight), 0_00000400, CallFlags.AllowStates, true); public static readonly InteropDescriptor System_Blockchain_GetBlock = Register("System.Blockchain.GetBlock", nameof(GetBlock), 0_02500000, CallFlags.AllowStates, true); public static readonly InteropDescriptor System_Blockchain_GetTransaction = Register("System.Blockchain.GetTransaction", nameof(GetTransaction), 0_01000000, CallFlags.AllowStates, true); @@ -97,7 +95,7 @@ protected internal ContractState GetContract(UInt160 hash) private static bool IsTraceableBlock(StoreView snapshot, uint index) { if (index > snapshot.Height) return false; - return index + MaxTraceableBlocks > snapshot.Height; + return index + ProtocolSettings.Default.MaxTraceableBlocks > snapshot.Height; } } } diff --git a/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs b/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs index 654b686160..b69c5f4759 100644 --- a/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs +++ b/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs @@ -71,7 +71,7 @@ public void System_Blockchain_GetBlock() // Not traceable block var height = snapshot.BlockHashIndex.GetAndChange(); - height.Index = block.Index + Transaction.MaxValidUntilBlockIncrement; + height.Index = block.Index + ProtocolSettings.Default.MaxTraceableBlocks; var blocks = snapshot.Blocks; var txs = snapshot.Transactions;