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
b1b75f00
Unverified
Commit
b1b75f00
authored
Jun 04, 2020
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts/keystore, cmd/faucet: return old account to allow unlock
parent
201e345c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
keystore.go
accounts/keystore/keystore.go
+9
-3
faucet.go
cmd/faucet/faucet.go
+3
-3
No files found.
accounts/keystore/keystore.go
View file @
b1b75f00
...
@@ -449,19 +449,25 @@ func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (ac
...
@@ -449,19 +449,25 @@ func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (ac
}
}
ks
.
importMu
.
Lock
()
ks
.
importMu
.
Lock
()
defer
ks
.
importMu
.
Unlock
()
defer
ks
.
importMu
.
Unlock
()
if
ks
.
cache
.
hasAddress
(
key
.
Address
)
{
if
ks
.
cache
.
hasAddress
(
key
.
Address
)
{
return
accounts
.
Account
{},
ErrAccountAlreadyExists
return
accounts
.
Account
{
Address
:
key
.
Address
,
},
ErrAccountAlreadyExists
}
}
return
ks
.
importKey
(
key
,
newPassphrase
)
return
ks
.
importKey
(
key
,
newPassphrase
)
}
}
// ImportECDSA stores the given key into the key directory, encrypting it with the passphrase.
// ImportECDSA stores the given key into the key directory, encrypting it with the passphrase.
func
(
ks
*
KeyStore
)
ImportECDSA
(
priv
*
ecdsa
.
PrivateKey
,
passphrase
string
)
(
accounts
.
Account
,
error
)
{
func
(
ks
*
KeyStore
)
ImportECDSA
(
priv
*
ecdsa
.
PrivateKey
,
passphrase
string
)
(
accounts
.
Account
,
error
)
{
key
:=
newKeyFromECDSA
(
priv
)
ks
.
importMu
.
Lock
()
ks
.
importMu
.
Lock
()
defer
ks
.
importMu
.
Unlock
()
defer
ks
.
importMu
.
Unlock
()
key
:=
newKeyFromECDSA
(
priv
)
if
ks
.
cache
.
hasAddress
(
key
.
Address
)
{
if
ks
.
cache
.
hasAddress
(
key
.
Address
)
{
return
accounts
.
Account
{},
ErrAccountAlreadyExists
return
accounts
.
Account
{
Address
:
key
.
Address
,
},
ErrAccountAlreadyExists
}
}
return
ks
.
importKey
(
key
,
passphrase
)
return
ks
.
importKey
(
key
,
passphrase
)
}
}
...
...
cmd/faucet/faucet.go
View file @
b1b75f00
...
@@ -162,7 +162,6 @@ func main() {
...
@@ -162,7 +162,6 @@ func main() {
if
blob
,
err
=
ioutil
.
ReadFile
(
*
accPassFlag
);
err
!=
nil
{
if
blob
,
err
=
ioutil
.
ReadFile
(
*
accPassFlag
);
err
!=
nil
{
log
.
Crit
(
"Failed to read account password contents"
,
"file"
,
*
accPassFlag
,
"err"
,
err
)
log
.
Crit
(
"Failed to read account password contents"
,
"file"
,
*
accPassFlag
,
"err"
,
err
)
}
}
// Delete trailing newline in password
pass
:=
strings
.
TrimSuffix
(
string
(
blob
),
"
\n
"
)
pass
:=
strings
.
TrimSuffix
(
string
(
blob
),
"
\n
"
)
ks
:=
keystore
.
NewKeyStore
(
filepath
.
Join
(
os
.
Getenv
(
"HOME"
),
".faucet"
,
"keys"
),
keystore
.
StandardScryptN
,
keystore
.
StandardScryptP
)
ks
:=
keystore
.
NewKeyStore
(
filepath
.
Join
(
os
.
Getenv
(
"HOME"
),
".faucet"
,
"keys"
),
keystore
.
StandardScryptN
,
keystore
.
StandardScryptP
)
...
@@ -173,8 +172,9 @@ func main() {
...
@@ -173,8 +172,9 @@ func main() {
if
err
!=
nil
&&
err
!=
keystore
.
ErrAccountAlreadyExists
{
if
err
!=
nil
&&
err
!=
keystore
.
ErrAccountAlreadyExists
{
log
.
Crit
(
"Failed to import faucet signer account"
,
"err"
,
err
)
log
.
Crit
(
"Failed to import faucet signer account"
,
"err"
,
err
)
}
}
ks
.
Unlock
(
acc
,
pass
)
if
err
:=
ks
.
Unlock
(
acc
,
pass
);
err
!=
nil
{
log
.
Crit
(
"Failed to unlock faucet signer account"
,
"err"
,
err
)
}
// Assemble and start the faucet light service
// Assemble and start the faucet light service
faucet
,
err
:=
newFaucet
(
genesis
,
*
ethPortFlag
,
enodes
,
*
netFlag
,
*
statsFlag
,
ks
,
website
.
Bytes
())
faucet
,
err
:=
newFaucet
(
genesis
,
*
ethPortFlag
,
enodes
,
*
netFlag
,
*
statsFlag
,
ks
,
website
.
Bytes
())
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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