*: remove duplicate functions producing verification script

Drop wif.GetVerificationScript(), drop
smartcontract.CreateSignatureRedeemScript(), add GetVerificationScript()
directly to the PublicKey and use it everywhere.
This commit is contained in:
Roman Khimov 2019-12-03 17:25:25 +03:00
parent 8d4dd2d2e1
commit 138e125646
6 changed files with 15 additions and 50 deletions

View file

@ -8,7 +8,6 @@ import (
"github.com/CityOfZion/neo-go/pkg/core/transaction"
"github.com/CityOfZion/neo-go/pkg/crypto/hash"
"github.com/CityOfZion/neo-go/pkg/crypto/keys"
"github.com/CityOfZion/neo-go/pkg/smartcontract"
"github.com/CityOfZion/neo-go/pkg/util"
"github.com/CityOfZion/neo-go/pkg/vm"
gherr "github.com/pkg/errors"
@ -309,11 +308,7 @@ func (ic *interopContext) checkHashedWitness(hash util.Uint160) (bool, error) {
// checkKeyedWitness checks hash of signature check contract with a given public
// key against current list of script hashes for verifying in the interop context.
func (ic *interopContext) checkKeyedWitness(key *keys.PublicKey) (bool, error) {
script, err := smartcontract.CreateSignatureRedeemScript(key)
if err != nil {
return false, gherr.Wrap(err, "failed to create signature script for a key")
}
return ic.checkHashedWitness(hash.Hash160(script))
return ic.checkHashedWitness(hash.Hash160(key.GetVerificationScript()))
}
// runtimeCheckWitness checks witnesses.