Skip to content

Commit

Permalink
Allow to search in witnesses (neo-project#1931)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Zhang <erik@neo.org>
  • Loading branch information
2 people authored and cloud8little committed Jan 24, 2021
1 parent ea7f38b commit 75fe3d8
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 75fe3d8

Please sign in to comment.