accounts, p2p, rpc: make CGO_ENABLED=0 build again (#19593)

* p2p: remove direct import of cgo-library

* accounts, rpc: more nocgo alternatives

* rpc: move unix path constant into separate file

* accounts/scwallet: address review concerns, remove copy-pasta
This commit is contained in:
Martin Holst Swende
2019-05-26 00:07:10 +02:00
committed by Péter Szilágyi
parent 9efc1a847e
commit fec3b56f7f
6 changed files with 71 additions and 34 deletions

View File

@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
"github.com/ethereum/go-ethereum/p2p/enode"
)
@ -64,7 +63,7 @@ func (e encPubkey) id() enode.ID {
// recoverNodeKey computes the public key used to sign the
// given hash from the signature.
func recoverNodeKey(hash, sig []byte) (key encPubkey, err error) {
pubkey, err := secp256k1.RecoverPubkey(hash, sig)
pubkey, err := crypto.Ecrecover(hash, sig)
if err != nil {
return key, err
}