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
469b8739
Unverified
Commit
469b8739
authored
Jun 04, 2020
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acounts/keystore, cmd/faucet: fix faucet double import, fix twitter url
parent
8b831257
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
keystore.go
accounts/keystore/keystore.go
+6
-2
faucet.go
cmd/faucet/faucet.go
+6
-3
No files found.
accounts/keystore/keystore.go
View file @
469b8739
...
@@ -43,6 +43,10 @@ var (
...
@@ -43,6 +43,10 @@ var (
ErrLocked
=
accounts
.
NewAuthNeededError
(
"password or unlock"
)
ErrLocked
=
accounts
.
NewAuthNeededError
(
"password or unlock"
)
ErrNoMatch
=
errors
.
New
(
"no key for given address or file"
)
ErrNoMatch
=
errors
.
New
(
"no key for given address or file"
)
ErrDecrypt
=
errors
.
New
(
"could not decrypt key with given password"
)
ErrDecrypt
=
errors
.
New
(
"could not decrypt key with given password"
)
// ErrAccountAlreadyExists is returned if an account attempted to import is
// already present in the keystore.
ErrAccountAlreadyExists
=
errors
.
New
(
"account alreaady exists"
)
)
)
// KeyStoreType is the reflect type of a keystore backend.
// KeyStoreType is the reflect type of a keystore backend.
...
@@ -446,7 +450,7 @@ func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (ac
...
@@ -446,7 +450,7 @@ 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
{},
errors
.
New
(
"account already exists"
)
return
accounts
.
Account
{},
ErrAccountAlreadyExists
}
}
return
ks
.
importKey
(
key
,
newPassphrase
)
return
ks
.
importKey
(
key
,
newPassphrase
)
}
}
...
@@ -457,7 +461,7 @@ func (ks *KeyStore) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (acco
...
@@ -457,7 +461,7 @@ func (ks *KeyStore) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (acco
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
{},
errors
.
New
(
"account already exists"
)
return
accounts
.
Account
{},
ErrAccountAlreadyExists
}
}
return
ks
.
importKey
(
key
,
passphrase
)
return
ks
.
importKey
(
key
,
passphrase
)
}
}
...
...
cmd/faucet/faucet.go
View file @
469b8739
...
@@ -170,7 +170,7 @@ func main() {
...
@@ -170,7 +170,7 @@ func main() {
log
.
Crit
(
"Failed to read account key contents"
,
"file"
,
*
accJSONFlag
,
"err"
,
err
)
log
.
Crit
(
"Failed to read account key contents"
,
"file"
,
*
accJSONFlag
,
"err"
,
err
)
}
}
acc
,
err
:=
ks
.
Import
(
blob
,
pass
,
pass
)
acc
,
err
:=
ks
.
Import
(
blob
,
pass
,
pass
)
if
err
!=
nil
{
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
)
ks
.
Unlock
(
acc
,
pass
)
...
@@ -694,8 +694,11 @@ func authTwitter(url string) (string, string, common.Address, error) {
...
@@ -694,8 +694,11 @@ func authTwitter(url string) (string, string, common.Address, error) {
return
""
,
""
,
common
.
Address
{},
errors
.
New
(
"Invalid Twitter status URL"
)
return
""
,
""
,
common
.
Address
{},
errors
.
New
(
"Invalid Twitter status URL"
)
}
}
// Twitter's API isn't really friendly with direct links. Still, we don't
// Twitter's API isn't really friendly with direct links. Still, we don't
// want to do ask read permissions from users, so just load the public posts and
// want to do ask read permissions from users, so just load the public posts
// scrape it for the Ethereum address and profile URL.
// and scrape it for the Ethereum address and profile URL. We need to load
// the mobile page though since the main page loads tweet contents via JS.
url
=
strings
.
Replace
(
url
,
"https://twitter.com/"
,
"https://mobile.twitter.com/"
,
1
)
res
,
err
:=
http
.
Get
(
url
)
res
,
err
:=
http
.
Get
(
url
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
""
,
common
.
Address
{},
err
return
""
,
""
,
common
.
Address
{},
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