Skip to content

Commit 9ed6cac

Browse files
shargonJim8yNGDAdmin
authored
Expose GetInteropDescriptor (neo-project#3545)
* Expose GetInteropDescriptor * Update src/Neo/SmartContract/ApplicationEngine.cs --------- Co-authored-by: Jimmy <jinghui@wayne.edu> Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
1 parent 85f52f5 commit 9ed6cac

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Neo/SmartContract/ApplicationEngine.cs

+13-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System.Linq;
2323
using System.Numerics;
2424
using System.Reflection;
25+
using System.Runtime.CompilerServices;
2526
using Array = System.Array;
2627
using VMArray = Neo.VM.Types.Array;
2728

@@ -241,9 +242,7 @@ protected static void OnSysCall(ExecutionEngine engine, Instruction instruction)
241242
{
242243
if (engine is ApplicationEngine app)
243244
{
244-
uint method = instruction.TokenU32;
245-
246-
app.OnSysCall(services[method]);
245+
app.OnSysCall(GetInteropDescriptor(instruction.TokenU32));
247246
}
248247
else
249248
{
@@ -641,6 +640,17 @@ private static InteropDescriptor Register(string name, string handler, long fixe
641640
return descriptor;
642641
}
643642

643+
/// <summary>
644+
/// Get Interop Descriptor
645+
/// </summary>
646+
/// <param name="methodHash">Method Hash</param>
647+
/// <returns>InteropDescriptor</returns>
648+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
649+
public static InteropDescriptor GetInteropDescriptor(uint methodHash)
650+
{
651+
return services[methodHash];
652+
}
653+
644654
/// <summary>
645655
/// Creates a new instance of the <see cref="ApplicationEngine"/> class, and use it to run the specified script.
646656
/// </summary>

0 commit comments

Comments
 (0)