wallet: add ScriptHash() method to Contract
This commit is contained in:
parent
a871f75063
commit
a798e4e0fa
2 changed files with 15 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/crypto/hash"
|
||||
"github.com/CityOfZion/neo-go/pkg/internal/keytestcases"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -66,6 +67,13 @@ func TestContract_MarshalJSON(t *testing.T) {
|
|||
require.Error(t, json.Unmarshal(data, &c))
|
||||
}
|
||||
|
||||
func TestContract_ScriptHash(t *testing.T) {
|
||||
script := []byte{0, 1, 2, 3}
|
||||
c := &Contract{Script: script}
|
||||
|
||||
require.Equal(t, hash.Hash160(script), c.ScriptHash())
|
||||
}
|
||||
|
||||
func compareFields(t *testing.T, tk keytestcases.Ktype, acc *Account) {
|
||||
if want, have := tk.Address, acc.Address; want != have {
|
||||
t.Fatalf("expected %s got %s", want, have)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue