p2p/discover: move discv4 encoding to new 'v4wire' package (#21147)

This moves all v4 protocol definitions to a new package, p2p/discover/v4wire.
The new package will be used for low-level protocol tests.
This commit is contained in:
Felix Lange
2020-06-02 13:20:19 +02:00
committed by GitHub
parent cd57d5cd38
commit 723bd8c17f
6 changed files with 654 additions and 515 deletions

View File

@ -61,17 +61,6 @@ func (e encPubkey) id() enode.ID {
return enode.ID(crypto.Keccak256Hash(e[:]))
}
// 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 := crypto.Ecrecover(hash, sig)
if err != nil {
return key, err
}
copy(key[:], pubkey[1:])
return key, nil
}
func wrapNode(n *enode.Node) *node {
return &node{Node: *n}
}