From dafb0cadad7ec8ada1f13c1378beab3557b0443e Mon Sep 17 00:00:00 2001 From: Hecate2 <2474101468@qq.com> Date: Thu, 12 Sep 2024 10:13:18 +0800 Subject: [PATCH] use timestamp: null in DebugRun --- Fairy.Debugger.cs | 2 +- Fairy.Engine.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Fairy.Debugger.cs b/Fairy.Debugger.cs index 99341ca..929b29b 100644 --- a/Fairy.Debugger.cs +++ b/Fairy.Debugger.cs @@ -174,7 +174,7 @@ private JObject DumpDebugResultJson(FairyEngine newEngine, BreakReason breakReas private FairyEngine DebugRun(byte[] script, DataCache snapshot, out BreakReason breakReason, IVerifiable? container = null, Block? persistingBlock = null, ProtocolSettings? settings = null, int offset = 0, long gas = FairyEngine.TestModeGas, IDiagnostic? diagnostic = null, FairyEngine oldEngine = null) { - persistingBlock ??= CreateDummyBlockWithTimestamp(snapshot, settings ?? ProtocolSettings.Default, timestamp: 0); + persistingBlock ??= CreateDummyBlockWithTimestamp(snapshot, settings ?? ProtocolSettings.Default, timestamp: null); FairyEngine engine = FairyEngine.Create(TriggerType.Application, container, snapshot, this, persistingBlock, settings, gas, diagnostic, oldEngine: oldEngine); engine.LoadScript(script, initialPosition: offset); return Execute(engine, out breakReason); diff --git a/Fairy.Engine.cs b/Fairy.Engine.cs index a930ece..9f553b8 100644 --- a/Fairy.Engine.cs +++ b/Fairy.Engine.cs @@ -162,7 +162,7 @@ public InteropDescriptor Register(string name, MethodInfo method, uint hash, lon return result; uint currentIndex = NativeContract.Ledger.CurrentIndex(Snapshot); Block currentBlock = NativeContract.Ledger.GetBlock(Snapshot, currentIndex); - return currentBlock.Timestamp + (ulong)ProtocolSettings.TimePerBlock.TotalMilliseconds; + return currentBlock.Timestamp + ProtocolSettings.MillisecondsPerBlock; } public ulong GetFairyTime() => runtimeArgs.timestamp != null ? (ulong)runtimeArgs.timestamp : GetTime(); //public ulong GetFairyBlockIndex() => serviceArgs.blockIndex != null ? (uint)serviceArgs.blockIndex : NativeContract.Ledger.CurrentIndex(this.Snapshot);