tutus-chain/internal/basicchain/testdata/verify/verification_contract.go

16 lines
552 B
Go
Executable File

package verify
import (
"git.marketally.com/tutus-one/tutus-chain/pkg/interop/lib/address"
"git.marketally.com/tutus-one/tutus-chain/pkg/interop/runtime"
"git.marketally.com/tutus-one/tutus-chain/pkg/interop/util"
)
// Verify is a verification contract method.
// It returns true iff it is signed by Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn (id-0 private key from testchain).
func Verify() bool {
tx := runtime.GetScriptContainer()
addr := address.ToHash160("Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn")
return util.Equals(string(tx.Sender), string(addr))
}