mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
Merge bb824a8557 into 6005dcef5b
This commit is contained in:
commit
45717daf49
2 changed files with 20 additions and 4 deletions
|
|
@ -528,12 +528,25 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
||||||
func accountList(ctx *cli.Context) {
|
func accountList(ctx *cli.Context) {
|
||||||
accman := utils.MakeAccountManager(ctx)
|
accman := utils.MakeAccountManager(ctx)
|
||||||
accts, err := accman.Accounts()
|
accts, err := accman.Accounts()
|
||||||
|
arg := ctx.Args().First()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Fatalf("Could not list accounts: %v", err)
|
utils.Fatalf("Could not list accounts: %v", err)
|
||||||
}
|
}
|
||||||
|
if arg != "" {
|
||||||
|
// arg is an integer for the key we want to print
|
||||||
|
i, err := strconv.Atoi(arg)
|
||||||
|
if err != nil {
|
||||||
|
utils.Fatalf("Must specify a valid integer argument: %v", err)
|
||||||
|
}
|
||||||
|
if i+1 > len(accts) {
|
||||||
|
utils.Fatalf("Cannot get key %d; there are only %d keys, and counting starts at 0", i, len(accts))
|
||||||
|
}
|
||||||
|
fmt.Printf("%x\n", accts[i].Address)
|
||||||
|
} else {
|
||||||
for i, acct := range accts {
|
for i, acct := range accts {
|
||||||
fmt.Printf("Account #%d: %x\n", i, acct)
|
fmt.Printf("Account #%d: %x\n", i, acct)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// getPassPhrase retrieves the passwor associated with an account, either fetched
|
// getPassPhrase retrieves the passwor associated with an account, either fetched
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,10 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrInvalidSig = errors.New("invalid v, r, s values")
|
var (
|
||||||
|
ErrInvalidSig = errors.New("invalid v, r, s values")
|
||||||
|
ErrInvalidPubKey = errors.New("invalid public key")
|
||||||
|
)
|
||||||
|
|
||||||
type Transaction struct {
|
type Transaction struct {
|
||||||
data txdata
|
data txdata
|
||||||
|
|
@ -202,7 +205,7 @@ func (tx *Transaction) publicKey() ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(pub) == 0 || pub[0] != 4 {
|
if len(pub) == 0 || pub[0] != 4 {
|
||||||
return nil, errors.New("invalid public key")
|
return nil, ErrInvalidPubKey
|
||||||
}
|
}
|
||||||
return pub, nil
|
return pub, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue