Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
230530f5
Unverified
Commit
230530f5
authored
Jan 17, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts, mobile: make account manager API a bit more uniform
parent
26d385c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
account_manager.go
accounts/account_manager.go
+3
-3
accounts_test.go
accounts/accounts_test.go
+4
-4
accounts.go
mobile/accounts.go
+1
-1
No files found.
accounts/account_manager.go
View file @
230530f5
...
...
@@ -113,9 +113,9 @@ func (am *Manager) Accounts() []Account {
return
am
.
cache
.
accounts
()
}
// Delete
Account
deletes the key matched by account if the passphrase is correct.
// If
a
contains no filename, the address must match a unique key.
func
(
am
*
Manager
)
Delete
Account
(
a
Account
,
passphrase
string
)
error
{
// Delete deletes the key matched by account if the passphrase is correct.
// If
the account
contains no filename, the address must match a unique key.
func
(
am
*
Manager
)
Delete
(
a
Account
,
passphrase
string
)
error
{
// Decrypting the key isn't really necessary, but we do
// it anyway to check the password and zero out the key
// immediately afterwards.
...
...
accounts/accounts_test.go
View file @
230530f5
...
...
@@ -53,14 +53,14 @@ func TestManager(t *testing.T) {
if
err
:=
am
.
Update
(
a
,
"foo"
,
"bar"
);
err
!=
nil
{
t
.
Errorf
(
"Update error: %v"
,
err
)
}
if
err
:=
am
.
Delete
Account
(
a
,
"bar"
);
err
!=
nil
{
t
.
Errorf
(
"Delete
Account
error: %v"
,
err
)
if
err
:=
am
.
Delete
(
a
,
"bar"
);
err
!=
nil
{
t
.
Errorf
(
"Delete error: %v"
,
err
)
}
if
common
.
FileExist
(
a
.
File
)
{
t
.
Errorf
(
"account file %s should be gone after Delete
Account
"
,
a
.
File
)
t
.
Errorf
(
"account file %s should be gone after Delete"
,
a
.
File
)
}
if
am
.
HasAddress
(
a
.
Address
)
{
t
.
Errorf
(
"HasAccount(%x) should've returned true after Delete
Account
"
,
a
.
Address
)
t
.
Errorf
(
"HasAccount(%x) should've returned true after Delete"
,
a
.
Address
)
}
}
...
...
mobile/accounts.go
View file @
230530f5
...
...
@@ -103,7 +103,7 @@ func (am *AccountManager) GetAccounts() *Accounts {
// DeleteAccount deletes the key matched by account if the passphrase is correct.
// If a contains no filename, the address must match a unique key.
func
(
am
*
AccountManager
)
DeleteAccount
(
account
*
Account
,
passphrase
string
)
error
{
return
am
.
manager
.
Delete
Account
(
accounts
.
Account
{
return
am
.
manager
.
Delete
(
accounts
.
Account
{
Address
:
account
.
account
.
Address
,
File
:
account
.
account
.
File
,
},
passphrase
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment