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
c0fcefa3
Commit
c0fcefa3
authored
11 years ago
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a GetKeys method to support multiple accounts
parent
c9f3d1c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
memory_database.go
ethdb/memory_database.go
+6
-0
db.go
ethutil/db.go
+1
-0
key.go
ethutil/key.go
+19
-0
No files found.
ethdb/memory_database.go
View file @
c0fcefa3
...
...
@@ -26,6 +26,12 @@ func (db *MemDatabase) Get(key []byte) ([]byte, error) {
return
db
.
db
[
string
(
key
)],
nil
}
func
(
db
*
MemDatabase
)
GetKeys
()
[]
*
ethutil
.
Key
{
data
,
_
:=
db
.
Get
([]
byte
(
"KeyRing"
))
return
[]
*
ethutil
.
Key
{
ethutil
.
NewKeyFromBytes
(
data
)}
}
func
(
db
*
MemDatabase
)
Delete
(
key
[]
byte
)
error
{
delete
(
db
.
db
,
string
(
key
))
...
...
This diff is collapsed.
Click to expand it.
ethutil/db.go
View file @
c0fcefa3
...
...
@@ -4,6 +4,7 @@ package ethutil
type
Database
interface
{
Put
(
key
[]
byte
,
value
[]
byte
)
Get
(
key
[]
byte
)
([]
byte
,
error
)
GetKeys
()
[]
*
Key
Delete
(
key
[]
byte
)
error
LastKnownTD
()
[]
byte
Close
()
...
...
This diff is collapsed.
Click to expand it.
ethutil/key.go
0 → 100644
View file @
c0fcefa3
package
ethutil
type
Key
struct
{
PrivateKey
[]
byte
PublicKey
[]
byte
}
func
NewKeyFromBytes
(
data
[]
byte
)
*
Key
{
val
:=
NewValueFromBytes
(
data
)
return
&
Key
{
val
.
Get
(
0
)
.
Bytes
(),
val
.
Get
(
1
)
.
Bytes
()}
}
func
(
k
*
Key
)
Address
()
[]
byte
{
return
Sha3Bin
(
k
.
PublicKey
[
1
:
])[
12
:
]
}
func
(
k
*
Key
)
RlpEncode
()
[]
byte
{
return
EmptyValue
()
.
Append
(
k
.
PrivateKey
)
.
Append
(
k
.
PublicKey
)
.
Encode
()
}
This diff is collapsed.
Click to expand it.
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