forked from TrueCloudLab/neoneo-go
core: fix ECDSA verifiation price, it's 1000000 and it's defined in crypto
This commit is contained in:
parent
97ea5593b0
commit
afc5ee1ded
1 changed files with 3 additions and 6 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/core/interop/crypto"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
|
@ -17,10 +18,6 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ecdsaVerifyInteropPrice returns the price of Neo.Crypto.ECDsaVerify
|
|
||||||
// syscall to calculate NetworkFee for transaction
|
|
||||||
const ecdsaVerifyInteropPrice = 100000
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// governingTokenTX represents transaction that is used to create
|
// governingTokenTX represents transaction that is used to create
|
||||||
// governing (NEO) token. It's a part of the genesis block.
|
// governing (NEO) token. It's a part of the genesis block.
|
||||||
|
@ -138,13 +135,13 @@ func CalculateNetworkFee(script []byte) (int64, int) {
|
||||||
)
|
)
|
||||||
if vm.IsSignatureContract(script) {
|
if vm.IsSignatureContract(script) {
|
||||||
size += 67 + io.GetVarSize(script)
|
size += 67 + io.GetVarSize(script)
|
||||||
netFee += opcodePrice(opcode.PUSHDATA1, opcode.PUSHNULL) + ecdsaVerifyInteropPrice
|
netFee += opcodePrice(opcode.PUSHDATA1, opcode.PUSHNULL) + crypto.ECDSAVerifyPrice
|
||||||
} else if n, pubs, ok := vm.ParseMultiSigContract(script); ok {
|
} else if n, pubs, ok := vm.ParseMultiSigContract(script); ok {
|
||||||
m := len(pubs)
|
m := len(pubs)
|
||||||
sizeInv := 66 * m
|
sizeInv := 66 * m
|
||||||
size += io.GetVarSize(sizeInv) + sizeInv + io.GetVarSize(script)
|
size += io.GetVarSize(sizeInv) + sizeInv + io.GetVarSize(script)
|
||||||
netFee += calculateMultisigFee(m) + calculateMultisigFee(n)
|
netFee += calculateMultisigFee(m) + calculateMultisigFee(n)
|
||||||
netFee += opcodePrice(opcode.PUSHNULL) + ecdsaVerifyInteropPrice*int64(n)
|
netFee += opcodePrice(opcode.PUSHNULL) + crypto.ECDSAVerifyPrice*int64(n)
|
||||||
} else {
|
} else {
|
||||||
// We can support more contract types in the future.
|
// We can support more contract types in the future.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue