diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d06c47eb3..a3c857bd4 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -15,7 +15,7 @@ - + diff --git a/src/OracleService/OracleService.cs b/src/OracleService/OracleService.cs index 5b94f034c..04274b6ad 100644 --- a/src/OracleService/OracleService.cs +++ b/src/OracleService/OracleService.cs @@ -10,10 +10,10 @@ using Neo.Network.P2P.Payloads; using Neo.Persistence; using Neo.SmartContract; +using Neo.SmartContract.Manifest; using Neo.SmartContract.Native; using Neo.VM; using Neo.Wallets; -using Neo.Wallets.NEP6; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -32,7 +32,7 @@ public class OracleService : Plugin, IPersistencePlugin { private const int RefreshInterval = 1000 * 60 * 3; - private NEP6Wallet wallet; + private Wallet wallet; private readonly ConcurrentDictionary pendingQueue = new ConcurrentDictionary(); private readonly ConcurrentDictionary finishedCache = new ConcurrentDictionary(); private Timer timer; @@ -73,21 +73,12 @@ public override void Dispose() private void OnStart() { if (started) return; - string password = GetService().ReadUserInput("password", true); - if (password.Length == 0) - { - Console.WriteLine("Cancelled"); - return; - } - wallet = new NEP6Wallet(Settings.Default.Wallet); - try - { - wallet.Unlock(password); - } - catch (System.Security.Cryptography.CryptographicException) + wallet = GetService().GetWallet(); + + if (wallet is null) { - Console.WriteLine($"Failed to open wallet"); + Console.WriteLine("Please open wallet first!"); return; } @@ -341,7 +332,8 @@ public static Transaction CreateResponseTx(StoreView snapshot, OracleRequest req var oracleContract = NativeContract.ContractManagement.GetContract(snapshot, NativeContract.Oracle.Hash); var engine = ApplicationEngine.Create(TriggerType.Verification, tx, snapshot.Clone()); - engine.LoadContract(oracleContract, "verify", CallFlags.None, true); + ContractMethodDescriptor md = oracleContract.Manifest.Abi.GetMethod("verify", -1); + engine.LoadContract(oracleContract, md, CallFlags.None); engine.Push("verify"); if (engine.Execute() != VMState.HALT) return null; tx.NetworkFee += engine.GasConsumed; diff --git a/src/OracleService/OracleService/config.json b/src/OracleService/OracleService/config.json index e08d8f6c2..7fd7f08ce 100644 --- a/src/OracleService/OracleService/config.json +++ b/src/OracleService/OracleService/config.json @@ -1,7 +1,6 @@ { "PluginConfiguration": { "Nodes": [], - "Wallet": "", "MaxTaskTimeout": 432000000, "AllowPrivateHost": false, "AllowedContentTypes": [ "application/json" ], diff --git a/src/OracleService/Settings.cs b/src/OracleService/Settings.cs index 282de2dc1..333100733 100644 --- a/src/OracleService/Settings.cs +++ b/src/OracleService/Settings.cs @@ -17,7 +17,6 @@ public HttpsSettings(IConfigurationSection section) class Settings { public string[] Nodes { get; } - public string Wallet { get; } public TimeSpan MaxTaskTimeout { get; } public bool AllowPrivateHost { get; } public string[] AllowedContentTypes { get; } @@ -28,7 +27,6 @@ class Settings private Settings(IConfigurationSection section) { Nodes = section.GetSection("Nodes").GetChildren().Select(p => p.Get()).ToArray(); - Wallet = section.GetValue("Wallet"); MaxTaskTimeout = TimeSpan.FromMilliseconds(section.GetValue("MaxTaskTimeout", 432000000)); AllowPrivateHost = section.GetValue("AllowPrivateHost", false); AllowedContentTypes = section.GetSection("AllowedContentTypes").GetChildren().Select(p => p.Get()).ToArray();