From a1590b0995b201100b2153d2c0e638732eda0cee Mon Sep 17 00:00:00 2001 From: Erik Zhang Date: Thu, 19 Nov 2020 17:39:26 +0800 Subject: [PATCH] Optimizations to CallFromNativeContract (#2073) --- src/neo/SmartContract/Native/Oracle/OracleContract.cs | 2 +- src/neo/SmartContract/Native/Tokens/Nep17Token.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/neo/SmartContract/Native/Oracle/OracleContract.cs b/src/neo/SmartContract/Native/Oracle/OracleContract.cs index 77797f3d52..347803d076 100644 --- a/src/neo/SmartContract/Native/Oracle/OracleContract.cs +++ b/src/neo/SmartContract/Native/Oracle/OracleContract.cs @@ -95,7 +95,7 @@ private void Finish(ApplicationEngine engine) if (request == null) throw new ArgumentException("Oracle request was not found"); engine.SendNotification(Hash, "OracleResponse", new VM.Types.Array { response.Id, request.OriginalTxid.ToArray() }); StackItem userData = BinarySerializer.Deserialize(request.UserData, engine.Limits.MaxStackSize, engine.Limits.MaxItemSize, engine.ReferenceCounter); - engine.CallFromNativeContract(() => { }, request.CallbackContract, request.CallbackMethod, request.Url, userData, (int)response.Code, response.Result); + engine.CallFromNativeContract(null, request.CallbackContract, request.CallbackMethod, request.Url, userData, (int)response.Code, response.Result); } private UInt256 GetOriginalTxid(ApplicationEngine engine) diff --git a/src/neo/SmartContract/Native/Tokens/Nep17Token.cs b/src/neo/SmartContract/Native/Tokens/Nep17Token.cs index c216908844..ad57c5a75a 100644 --- a/src/neo/SmartContract/Native/Tokens/Nep17Token.cs +++ b/src/neo/SmartContract/Native/Tokens/Nep17Token.cs @@ -162,9 +162,9 @@ private void PostTransfer(ApplicationEngine engine, UInt160 from, UInt160 to, Bi if (to is null || engine.Snapshot.Contracts.TryGet(to) is null) return; - // Call onPayment method if exists (NEP-17) + // Call onPayment method (NEP-17) - engine.CallFromNativeContract(() => { }, to, "onPayment", from.ToArray(), amount); + engine.CallFromNativeContract(null, to, "onPayment", from.ToArray(), amount); } } }