public void Reset(DataNode inputs, ABI ABI) { if (contractByteCode == null || contractByteCode.Length == 0) { throw new Exception("Contract bytecode is not set yet!"); } if (lastState.state == DebuggerState.State.Reset) { return; } if (currentTransaction == null) { //throw new Exception("Transaction not set"); currentTransaction = new Transaction(this.blockchain.currentBlock); } usedGas = 0; usedOpcodeCount = 0; currentTransaction.emulator = this; engine = new ExecutionEngine(currentTransaction, Crypto.Default, null, interop); engine.LoadScript(contractByteCode); foreach (var output in currentTransaction.outputs) { if (output.hash == this.currentHash) { output.hash = new UInt160(engine.CurrentContext.ScriptHash); } } foreach (var pos in _breakpoints) { engine.AddBreakPoint((uint)pos); } using (ScriptBuilder sb = new ScriptBuilder()) { var items = new Stack <object>(); if (inputs != null) { foreach (var item in inputs.Children) { var obj = Emulator.ConvertArgument(item); items.Push(obj); } } while (items.Count > 0) { var item = items.Pop(); EmitObject(sb, item); } var loaderScript = sb.ToArray(); //System.IO.File.WriteAllBytes("loader.avm", loaderScript); engine.LoadScript(loaderScript); } //engine.Reset(); lastState = new DebuggerState(DebuggerState.State.Reset, 0); currentTransaction = null; _variables.Clear(); this._ABI = ABI; }