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
ed90efb0
Commit
ed90efb0
authored
Feb 24, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #378 from Gustav-Simonsson/fix_account_manager_tests
Fix key store address hex decoding and accounts test
parents
5a43173e
923950cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
account_manager.go
accounts/account_manager.go
+4
-0
accounts_test.go
accounts/accounts_test.go
+13
-1
key_store_plain.go
crypto/key_store_plain.go
+5
-2
No files found.
accounts/account_manager.go
View file @
ed90efb0
...
...
@@ -56,6 +56,10 @@ func NewAccountManager(keyStore crypto.KeyStore2) AccountManager {
return
*
am
}
func
(
am
AccountManager
)
DeleteAccount
(
address
[]
byte
,
auth
string
)
error
{
return
am
.
keyStore
.
DeleteKey
(
address
,
auth
)
}
func
(
am
*
AccountManager
)
Sign
(
fromAccount
*
Account
,
keyAuth
string
,
toSign
[]
byte
)
(
signature
[]
byte
,
err
error
)
{
key
,
err
:=
am
.
keyStore
.
GetKey
(
fromAccount
.
Address
,
keyAuth
)
if
err
!=
nil
{
...
...
accounts/accounts_test.go
View file @
ed90efb0
...
...
@@ -9,7 +9,7 @@ import (
)
func
TestAccountManager
(
t
*
testing
.
T
)
{
ks
:=
crypto
.
NewKeyStorePlain
(
ethutil
.
DefaultDataDir
())
ks
:=
crypto
.
NewKeyStorePlain
(
ethutil
.
DefaultDataDir
()
+
"/testaccounts"
)
am
:=
NewAccountManager
(
ks
)
pass
:=
""
// not used but required by API
a1
,
err
:=
am
.
NewAccount
(
pass
)
...
...
@@ -18,4 +18,16 @@ func TestAccountManager(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// Cleanup
accounts
,
err
:=
am
.
Accounts
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
for
_
,
account
:=
range
accounts
{
err
:=
am
.
DeleteAccount
(
account
.
Address
,
pass
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
}
crypto/key_store_plain.go
View file @
ed90efb0
...
...
@@ -119,8 +119,11 @@ func GetKeyAddresses(keysDirPath string) (addresses [][]byte, err error) {
}
addresses
=
make
([][]
byte
,
len
(
fileInfos
))
for
i
,
fileInfo
:=
range
fileInfos
{
addresses
[
i
]
=
make
([]
byte
,
40
)
addresses
[
i
]
=
[]
byte
(
fileInfo
.
Name
())
address
,
err
:=
hex
.
DecodeString
(
fileInfo
.
Name
())
if
err
!=
nil
{
continue
}
addresses
[
i
]
=
address
}
return
addresses
,
err
}
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