Skip to content

Commit

Permalink
Allow to search in witnesses (#1931)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Zhang <erik@neo.org>
  • Loading branch information
shargon and erikzhang authored Sep 14, 2020
1 parent c18a267 commit 9a160c4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/neo/Wallets/Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9a160c4

Please sign in to comment.