From 3ca0a3721a21856df6b2fb0fbd3f5c507759d952 Mon Sep 17 00:00:00 2001 From: Shargon Date: Sat, 12 Sep 2020 16:20:23 +0200 Subject: [PATCH] Allow to search in witnesses --- src/neo/Wallets/Wallet.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/neo/Wallets/Wallet.cs b/src/neo/Wallets/Wallet.cs index 1e9049b72d..75dc069768 100644 --- a/src/neo/Wallets/Wallet.cs +++ b/src/neo/Wallets/Wallet.cs @@ -371,6 +371,21 @@ public long CalculateNetworkFee(StoreView snapshot, Transaction tx) foreach (UInt160 hash in hashes) { byte[] witness_script = GetAccount(hash)?.Contract?.Script; + + if (witness_script is null && tx.Witnesses != null) + { + // Try to find the script in the witnesses + + foreach (var witness in tx.Witnesses) + { + if (witness.ScriptHash == hash) + { + witness_script = witness.VerificationScript; + break; + } + } + } + if (witness_script is null) { var contract = snapshot.Contracts.TryGet(hash);