Skip to content

Commit

Permalink
Revert MaxValidUntilBlockIncrement
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiao Jin committed Nov 4, 2020
1 parent a6af456 commit 7c54fa2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/neo/Network/P2P/Payloads/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Neo.Network.P2P.Payloads
public class Transaction : IEquatable<Transaction>, IInventory, IInteroperable
{
public const int MaxTransactionSize = 102400;
public const uint MaxValidUntilBlockIncrement = 5760; // 24 hour
/// <summary>
/// Maximum number of attributes that can be contained within a transaction
/// </summary>
Expand Down Expand Up @@ -282,7 +283,7 @@ bool IInventory.Verify(StoreView snapshot)

public virtual VerifyResult VerifyStateDependent(StoreView snapshot, TransactionVerificationContext context)
{
if (ValidUntilBlock <= snapshot.Height || ValidUntilBlock > snapshot.Height + ProtocolSettings.Default.MaxValidUntilBlockIncrement)
if (ValidUntilBlock <= snapshot.Height || ValidUntilBlock > snapshot.Height + MaxValidUntilBlockIncrement)
return VerifyResult.Expired;
foreach (UInt160 hash in GetScriptHashesForVerifying(snapshot))
if (NativeContract.Policy.IsBlocked(snapshot, hash))
Expand Down
4 changes: 1 addition & 3 deletions src/neo/ProtocolSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class ProtocolSettings
public string[] SeedList { get; }
public uint MillisecondsPerBlock { get; }
public int MemoryPoolMaxTransactions { get; }
public uint MaxValidUntilBlockIncrement { get; }
public uint MaxTraceableBlocks { get; }

static ProtocolSettings _default;
Expand Down Expand Up @@ -96,8 +95,7 @@ private ProtocolSettings(IConfigurationSection section)
};
this.MillisecondsPerBlock = section.GetValue("MillisecondsPerBlock", 15000u);
this.MemoryPoolMaxTransactions = Math.Max(1, section.GetValue("MemoryPoolMaxTransactions", 50_000));
this.MaxValidUntilBlockIncrement = section.GetValue("MaxValidUntilBlockIncrement", 5760u); // 24 hour
this.MaxTraceableBlocks = section.GetValue("MaxTraceableBlocks", 2_102_400u); // 365 days
this.MaxTraceableBlocks = section.GetValue("MaxTraceableBlocks", 2_102_400u);// 365 days
}
}
}
2 changes: 1 addition & 1 deletion src/neo/Wallets/Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ private Transaction MakeTransaction(StoreView snapshot, byte[] script, Signer[]
Version = 0,
Nonce = (uint)rand.Next(),
Script = script,
ValidUntilBlock = snapshot.Height + ProtocolSettings.Default.MaxValidUntilBlockIncrement,
ValidUntilBlock = snapshot.Height + Transaction.MaxValidUntilBlockIncrement,
Signers = GetSigners(account, cosigners),
Attributes = attributes,
};
Expand Down

0 comments on commit 7c54fa2

Please sign in to comment.