From 3134e364b2c57bb8864a2ba5c257ade8993ad418 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 13 Jul 2020 18:05:46 +0300 Subject: [PATCH] core: fix CalculateNetworkFee() for multisig contracts We return m from the vm.ParseMultiSigContract and n is the length of pubs, invocation script then pushes m signatures for n keys. --- pkg/core/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/core/util.go b/pkg/core/util.go index 792b38a7e..7f1b64d83 100644 --- a/pkg/core/util.go +++ b/pkg/core/util.go @@ -136,8 +136,8 @@ func CalculateNetworkFee(script []byte) (int64, int) { if vm.IsSignatureContract(script) { size += 67 + io.GetVarSize(script) netFee += opcodePrice(opcode.PUSHDATA1, opcode.PUSHNULL) + crypto.ECDSAVerifyPrice - } else if n, pubs, ok := vm.ParseMultiSigContract(script); ok { - m := len(pubs) + } else if m, pubs, ok := vm.ParseMultiSigContract(script); ok { + n := len(pubs) sizeInv := 66 * m size += io.GetVarSize(sizeInv) + sizeInv + io.GetVarSize(script) netFee += calculateMultisigFee(m) + calculateMultisigFee(n)