Skip to content

Commit

Permalink
Call _initialize() automatically (neo-project#1572)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored and Tommo-L committed Jun 22, 2020
1 parent 1170143 commit 6f63594
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/neo/SmartContract/InteropService.Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ private static bool Contract_CallEx(ApplicationEngine engine)

private static bool Contract_CallEx(ApplicationEngine engine, UInt160 contractHash, string method, Array args, CallFlags flags)
{
if (method.StartsWith('_')) return false;

ContractState contract = engine.Snapshot.Contracts.TryGet(contractHash);
if (contract is null) return false;

Expand Down Expand Up @@ -174,6 +176,10 @@ private static bool Contract_CallEx(ApplicationEngine engine, UInt160 contractHa
context_new.EvaluationStack.Push(args[i]);
context_new.InstructionPointer = md.Offset;
}

md = contract.Manifest.Abi.GetMethod("_initialize");
if (md != null) engine.LoadClonedContext(md.Offset);

return true;
}

Expand Down

0 comments on commit 6f63594

Please sign in to comment.