diff --git a/src/neo/Network/P2P/Payloads/OracleResponse.cs b/src/neo/Network/P2P/Payloads/OracleResponse.cs index c979c2e143..aaf082ba55 100644 --- a/src/neo/Network/P2P/Payloads/OracleResponse.cs +++ b/src/neo/Network/P2P/Payloads/OracleResponse.cs @@ -71,7 +71,7 @@ public override bool Verify(StoreView snapshot, Transaction tx) OracleRequest request = NativeContract.Oracle.GetRequest(snapshot, Id); if (request is null) return false; if (tx.NetworkFee + tx.SystemFee != request.GasForResponse) return false; - UInt160 oracleAccount = Blockchain.GetConsensusAddress(NativeContract.Designate.GetDesignatedByRole(snapshot, Role.Oracle, snapshot.Height)); + UInt160 oracleAccount = Blockchain.GetConsensusAddress(NativeContract.Designate.GetDesignatedByRole(snapshot, Role.Oracle, snapshot.Height + 1)); return tx.Signers.Any(p => p.Account.Equals(oracleAccount)); } } diff --git a/src/neo/SmartContract/Native/Designate/DesignateContract.cs b/src/neo/SmartContract/Native/Designate/DesignateContract.cs index 2587c0025d..b6e0fbe248 100644 --- a/src/neo/SmartContract/Native/Designate/DesignateContract.cs +++ b/src/neo/SmartContract/Native/Designate/DesignateContract.cs @@ -30,7 +30,7 @@ public ECPoint[] GetDesignatedByRole(StoreView snapshot, Role role, uint index) { if (!Enum.IsDefined(typeof(Role), role)) throw new ArgumentOutOfRangeException(nameof(role)); - if (snapshot.Height + 2 < index) + if (snapshot.Height + 1 < index) throw new ArgumentOutOfRangeException(nameof(index)); byte[] key = CreateStorageKey((byte)role).AddBigEndian(index).ToArray(); byte[] boundary = CreateStorageKey((byte)role).ToArray(); diff --git a/src/neo/SmartContract/Native/Oracle/OracleContract.cs b/src/neo/SmartContract/Native/Oracle/OracleContract.cs index 436644e55b..c1b06f228c 100644 --- a/src/neo/SmartContract/Native/Oracle/OracleContract.cs +++ b/src/neo/SmartContract/Native/Oracle/OracleContract.cs @@ -107,7 +107,7 @@ protected override void PostPersist(ApplicationEngine engine) if (list.Count == 0) engine.Snapshot.Storages.Delete(key); //Mint GAS for oracle nodes - nodes ??= NativeContract.Designate.GetDesignatedByRole(engine.Snapshot, Role.Oracle, engine.Snapshot.Height).Select(p => (Contract.CreateSignatureRedeemScript(p).ToScriptHash(), BigInteger.Zero)).ToArray(); + nodes ??= NativeContract.Designate.GetDesignatedByRole(engine.Snapshot, Role.Oracle, engine.Snapshot.PersistingBlock.Index).Select(p => (Contract.CreateSignatureRedeemScript(p).ToScriptHash(), BigInteger.Zero)).ToArray(); if (nodes.Length > 0) { int index = (int)(response.Id % (ulong)nodes.Length);