diff --git a/accounts/external/backend.go b/accounts/external/backend.go index c751e82d4a..d879223566 100644 --- a/accounts/external/backend.go +++ b/accounts/external/backend.go @@ -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 { diff --git a/cmd/geth/main.go b/cmd/geth/main.go index e487c87a04..cc7d02752f 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -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), ",") diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 37529345a3..60f3692a37 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -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) diff --git a/consensus/clique/snapshot_test.go b/consensus/clique/snapshot_test.go index 41dae1426f..94f746f9d0 100644 --- a/consensus/clique/snapshot_test.go +++ b/consensus/clique/snapshot_test.go @@ -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) } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 22e077fe75..765bc516d0 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -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)) // diff --git a/node/config.go b/node/config.go index 8f76cd570a..b840b5593c 100644 --- a/node/config.go +++ b/node/config.go @@ -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 } diff --git a/signer/core/api.go b/signer/core/api.go index 6354b3c3c3..e112df9c75 100644 --- a/signer/core/api.go +++ b/signer/core/api.go @@ -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)