mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
accounts, internal, signer: formatting
This commit is contained in:
parent
e29a666258
commit
a6239990a2
7 changed files with 12 additions and 12 deletions
5
accounts/external/backend.go
vendored
5
accounts/external/backend.go
vendored
|
|
@ -18,6 +18,9 @@ package external
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
"sync"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -28,8 +31,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/ethereum/go-ethereum/signer/core"
|
||||
"math/big"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type ExternalBackend struct {
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
|||
utils.StartNode(stack)
|
||||
|
||||
// Unlock any account specifically requested
|
||||
if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0{
|
||||
if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0 {
|
||||
ks := keystores[0].(*keystore.KeyStore)
|
||||
passwords := utils.MakePasswordList(ctx)
|
||||
unlocks := strings.Split(ctx.GlobalString(utils.UnlockedAccountFlag.Name), ",")
|
||||
|
|
|
|||
|
|
@ -890,7 +890,7 @@ func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) {
|
|||
Fatalf("Invalid miner etherbase: %v", err)
|
||||
}
|
||||
cfg.Etherbase = account.Address
|
||||
}else{
|
||||
} else {
|
||||
Fatalf("No etherbase configured")
|
||||
}
|
||||
}
|
||||
|
|
@ -991,7 +991,7 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
|||
|
||||
setDataDir(ctx, cfg)
|
||||
|
||||
if ctx.GlobalIsSet( ExternalSignerFlag.Name){
|
||||
if ctx.GlobalIsSet(ExternalSignerFlag.Name) {
|
||||
cfg.ExternalSigner = ctx.GlobalString(ExternalSignerFlag.Name)
|
||||
}
|
||||
|
||||
|
|
@ -1176,7 +1176,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
|
|||
checkExclusive(ctx, LightServFlag, SyncModeFlag, "light")
|
||||
|
||||
var ks *keystore.KeyStore
|
||||
if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0{
|
||||
if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0 {
|
||||
ks = keystores[0].(*keystore.KeyStore)
|
||||
}
|
||||
setEtherbase(ctx, ks, cfg)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
@ -80,7 +81,7 @@ func (ap *testerAccountPool) sign(header *types.Header, signer string) {
|
|||
ap.accounts[signer], _ = crypto.GenerateKey()
|
||||
}
|
||||
// Sign the header and embed the signature in extra data
|
||||
sig, _ := crypto.Sign(sigHash(header).Bytes(), ap.accounts[signer])
|
||||
sig, _ := crypto.Sign(accounts.CliqueHash(header).Bytes(), ap.accounts[signer])
|
||||
copy(header.Extra[len(header.Extra)-extraSeal:], sig)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -409,7 +409,6 @@ func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args SendTxArgs
|
|||
return &SignTransactionResult{data, signed}, nil
|
||||
}
|
||||
|
||||
|
||||
// Sign calculates an Ethereum ECDSA signature for:
|
||||
// keccack256("\x19Ethereum Signed Message:\n" + len(message) + message))
|
||||
//
|
||||
|
|
|
|||
|
|
@ -436,11 +436,11 @@ func makeAccountManager(conf *Config) (*accounts.Manager, string, error) {
|
|||
// Assemble the account manager and supported backends
|
||||
backends := []accounts.Backend{}
|
||||
if len(conf.ExternalSigner) > 0 {
|
||||
if extapi,err := external.NewExternalBackend(conf.ExternalSigner); err == nil{
|
||||
if extapi, err := external.NewExternalBackend(conf.ExternalSigner); err == nil {
|
||||
backends = append(backends, extapi)
|
||||
}
|
||||
}
|
||||
if len(backends) == 0{
|
||||
if len(backends) == 0 {
|
||||
// For now, we're using EITHER external signer OR local signers.
|
||||
// If/when we implement some form of lockfile for USB and keystore wallets,
|
||||
// we can have both, but it's very confusing for the user to see the same
|
||||
|
|
@ -462,7 +462,6 @@ func makeAccountManager(conf *Config) (*accounts.Manager, string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return accounts.NewManager(backends...), ephemeral, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ type ExternalAPI interface {
|
|||
New(ctx context.Context) (accounts.Account, error)
|
||||
// SignTransaction request to sign the specified transaction
|
||||
SignTransaction(ctx context.Context, args SendTxArgs, methodSelector *string) (*ethapi.SignTransactionResult, error)
|
||||
// Sign - resquest to sign the given data (plus prefix)
|
||||
// Sign - request to sign the given data (plus prefix)
|
||||
Sign(ctx context.Context, addr common.MixedcaseAddress, data hexutil.Bytes) (hexutil.Bytes, error)
|
||||
// Export - request to export an account
|
||||
Export(ctx context.Context, addr common.Address) (json.RawMessage, error)
|
||||
|
|
|
|||
Loading…
Reference in a new issue