Skip to content

Commit

Permalink
use timestamp: null in DebugRun
Browse files Browse the repository at this point in the history
  • Loading branch information
Hecate2 committed Sep 12, 2024
1 parent 58acea9 commit dafb0ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Fairy.Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Fairy.Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dafb0ca

Please sign in to comment.