9 "github.com/vapor/blockchain/pseudohsm"
10 "github.com/vapor/crypto/ed25519/chainkd"
13 func TestAccountIndexKey(t *testing.T) {
14 dirPath, err := ioutil.TempDir(".", "TestAccount")
18 defer os.RemoveAll(dirPath)
20 hsm, err := pseudohsm.New(dirPath)
25 xpub1, _, err := hsm.XCreate("TestAccountIndex1", "password", "en")
30 xpub2, _, err := hsm.XCreate("TestAccountIndex2", "password", "en")
35 xpubs1 := []chainkd.XPub{xpub1.XPub, xpub2.XPub}
36 xpubs2 := []chainkd.XPub{xpub2.XPub, xpub1.XPub}
37 if !reflect.DeepEqual(accountIndexKey(xpubs1), accountIndexKey(xpubs2)) {
38 t.Fatal("accountIndexKey test err")
41 if reflect.DeepEqual(xpubs1, xpubs2) {
42 t.Fatal("accountIndexKey test err")