Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose GetInteropDescriptor #3545

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/Neo/SmartContract/ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using Array = System.Array;
using VMArray = Neo.VM.Types.Array;

Expand Down Expand Up @@ -241,9 +242,7 @@ protected static void OnSysCall(ExecutionEngine engine, Instruction instruction)
{
if (engine is ApplicationEngine app)
{
uint method = instruction.TokenU32;

app.OnSysCall(services[method]);
app.OnSysCall(GetInteropDescriptor(instruction.TokenU32));
}
else
{
Expand Down Expand Up @@ -641,6 +640,17 @@ private static InteropDescriptor Register(string name, string handler, long fixe
return descriptor;
}

/// <summary>
/// Get Interop Descriptor
/// </summary>
/// <param name="methodHash">Method Hash</param>
/// <returns>InteropDescriptor</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static InteropDescriptor GetInteropDescriptor(uint methodHash)
{
return services[methodHash];
}

/// <summary>
/// Creates a new instance of the <see cref="ApplicationEngine"/> class, and use it to run the specified script.
/// </summary>
Expand Down
Loading