MCPcopy Create free account
hub / github.com/SmartPool/smartpool-client / GetAddress

Function GetAddress

ethereum/geth/account.go:20–49  ·  view source on GitHub ↗
(keystorePath string, address common.Address)

Source from the content-addressed store, hash-verified

18func (ma MinerAccount) Address() common.Address { return ma.address }
19
20func GetAddress(keystorePath string, address common.Address) (common.Address, bool, []common.Address) {
21 keys := keystore.NewKeyStore(
22 keystorePath,
23 keystore.StandardScryptN,
24 keystore.StandardScryptP,
25 )
26 var acc *accounts.Account
27 addresses := []common.Address{}
28 for _, a := range keys.Accounts() {
29 addresses = append(addresses, a.Address)
30 }
31 defaultAcc := big.NewInt(0)
32 if address.Big().Cmp(defaultAcc) == 0 {
33 if len(keys.Accounts()) == 0 {
34 return address, false, addresses
35 }
36 acc = &keys.Accounts()[0]
37 } else {
38 for _, a := range keys.Accounts() {
39 if a.Address == address {
40 acc = &a
41 break
42 }
43 }
44 }
45 if acc == nil {
46 return address, false, addresses
47 }
48 return acc.Address, true, addresses
49}
50
51// Get the first account in key store
52// Return nil if there's no account

Callers

nothing calls this directly

Calls 1

BigMethod · 0.45

Tested by

no test coverage detected