From e32ef6ef4868d82c8fba0177030ec56a14a718b0 Mon Sep 17 00:00:00 2001 From: Shargon Date: Wed, 3 Aug 2022 15:56:48 +0200 Subject: [PATCH] Remove Oracle Request (#2795) * Remove Oracle Request * Change logic * Use invocation Counter * Update src/Neo/SmartContract/Native/OracleContract.cs Co-authored-by: Erik Zhang Co-authored-by: Erik Zhang --- src/Neo/SmartContract/Native/OracleContract.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Neo/SmartContract/Native/OracleContract.cs b/src/Neo/SmartContract/Native/OracleContract.cs index bc64424b43..df35bd98e8 100644 --- a/src/Neo/SmartContract/Native/OracleContract.cs +++ b/src/Neo/SmartContract/Native/OracleContract.cs @@ -116,6 +116,8 @@ public long GetPrice(DataCache snapshot) [ContractMethod(RequiredCallFlags = CallFlags.States | CallFlags.AllowCall | CallFlags.AllowNotify)] private ContractTask Finish(ApplicationEngine engine) { + if (engine.InvocationStack.Count != 2) throw new InvalidOperationException(); + if (engine.GetInvocationCounter() != 1) throw new InvalidOperationException(); Transaction tx = (Transaction)engine.ScriptContainer; OracleResponse response = tx.GetAttribute(); if (response == null) throw new ArgumentException("Oracle response was not found");