Skip to content

Commit

Permalink
Fixes #999
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Aug 6, 2019
1 parent 48b216c commit 2ef5d34
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions neo/Wallets/Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,17 @@ private Transaction MakeTransaction(Snapshot snapshot, TransactionAttribute[] at
int size = Transaction.HeaderSize + attributes.GetVarSize() + script.GetVarSize() + IO.Helper.GetVarSize(hashes.Length);
foreach (UInt160 hash in hashes)
{
script = GetAccount(hash)?.Contract?.Script ?? snapshot.Contracts.TryGet(hash)?.Script;
if (script is null) continue;
if (script.IsSignatureContract())
byte[] witness_script = GetAccount(hash)?.Contract?.Script ?? snapshot.Contracts.TryGet(hash)?.Script;
if (witness_script is null) continue;
if (witness_script.IsSignatureContract())
{
size += 66 + script.GetVarSize();
size += 66 + witness_script.GetVarSize();
tx.NetworkFee += ApplicationEngine.OpCodePrices[OpCode.PUSHBYTES64] + ApplicationEngine.OpCodePrices[OpCode.PUSHBYTES33] + InteropService.GetPrice(InteropService.Neo_Crypto_CheckSig, null);
}
else if (script.IsMultiSigContract(out int m, out int n))
else if (witness_script.IsMultiSigContract(out int m, out int n))
{
int size_inv = 65 * m;
size += IO.Helper.GetVarSize(size_inv) + size_inv + script.GetVarSize();
size += IO.Helper.GetVarSize(size_inv) + size_inv + witness_script.GetVarSize();
tx.NetworkFee += ApplicationEngine.OpCodePrices[OpCode.PUSHBYTES64] * m;
using (ScriptBuilder sb = new ScriptBuilder())
tx.NetworkFee += ApplicationEngine.OpCodePrices[(OpCode)sb.EmitPush(m).ToArray()[0]];
Expand Down

0 comments on commit 2ef5d34

Please sign in to comment.