Skip to content

Commit

Permalink
Optimizations to CallFromNativeContract (neo-project#2073)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored and cloud8little committed Jan 24, 2021
1 parent 07d9101 commit 8f10702
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/neo/SmartContract/Native/Oracle/OracleContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/neo/SmartContract/Native/Tokens/Nep17Token.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 8f10702

Please sign in to comment.