RemindAccountDetails() -> RecoverAccount()
This commit is contained in:
parent
e1db1bbf44
commit
574f67999d
|
@ -82,7 +82,7 @@ func createAccount(password string) (string, string, string, error) {
|
||||||
return "", "", "", errors.New("No running node detected for account creation")
|
return "", "", "", errors.New("No running node detected for account creation")
|
||||||
}
|
}
|
||||||
|
|
||||||
func remindAccountDetails(password, mnemonic string) (string, string, error) {
|
func recoverAccount(password, mnemonic string) (string, string, error) {
|
||||||
|
|
||||||
if currentNode != nil {
|
if currentNode != nil {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ const (
|
||||||
whisperMessage5 = "test message 5 (K2 -> K1)"
|
whisperMessage5 = "test message 5 (K2 -> K1)"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRemindAccountDetails(t *testing.T) {
|
func TestRecoverAccount(t *testing.T) {
|
||||||
err := prepareTestNode()
|
err := prepareTestNode()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
@ -48,14 +48,14 @@ func TestRemindAccountDetails(t *testing.T) {
|
||||||
}
|
}
|
||||||
glog.V(logger.Info).Infof("Account created: {address: %s, key: %s, mnemonic:%s}", address, pubKey, mnemonic)
|
glog.V(logger.Info).Infof("Account created: {address: %s, key: %s, mnemonic:%s}", address, pubKey, mnemonic)
|
||||||
|
|
||||||
// try reminding using password + mnemonic
|
// try recovering using password + mnemonic
|
||||||
addressCheck, pubKeyCheck, err := remindAccountDetails(newAccountPassword, mnemonic)
|
addressCheck, pubKeyCheck, err := recoverAccount(newAccountPassword, mnemonic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("remind details failed: %v", err)
|
t.Errorf("recover account failed: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if address != addressCheck || pubKey != pubKeyCheck {
|
if address != addressCheck || pubKey != pubKeyCheck {
|
||||||
t.Error("Test failed: remind account details failed to pull the correct details")
|
t.Error("Test failed: recover account details failed to pull the correct details")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ func CreateAccount(password *C.char) *C.char {
|
||||||
return C.CString(string(outBytes))
|
return C.CString(string(outBytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
//export RemindAccountDetails
|
//export RecoverAccount
|
||||||
func RemindAccountDetails(password, mnemonic *C.char) *C.char {
|
func RecoverAccount(password, mnemonic *C.char) *C.char {
|
||||||
|
|
||||||
address, pubKey, err := remindAccountDetails(C.GoString(password), C.GoString(mnemonic))
|
address, pubKey, err := recoverAccount(C.GoString(password), C.GoString(mnemonic))
|
||||||
|
|
||||||
errString := emptyError
|
errString := emptyError
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue