ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.14k stars 19.95k forks source link

Lines 407-410 of p2p/discover/discv5.go breaks backwards compatibility with v3 and v4 packets, undocumented change and running on bootnodes? #16812

Closed MichaelJFlynn closed 5 years ago

MichaelJFlynn commented 6 years ago

Hi,

I ran into this problem with a custom Ethereum implementation suddenly unable to connect to the Ethereum bootnodes. Specifically, I ping bootnodes and get no response. I could set up my own bootnode and receive a response fine, unless I set a v5 flag to on, in which case I get an error: "bad prefix". I found the place in the code that corresponds to this error, apparently there has been some changes made to do away with the message hash on all packets and replace it with a prefix string, which is currently the empty string? This breaks both v3 and v4 packets, not sure if this is running on bootnodes? Relevant code below:

prefix, sig, sigdata := buf[:versionPrefixSize], buf[versionPrefixSize:headSize], buf[headSize:]
if !bytes.Equal(prefix, versionPrefix) {
    return errBadPrefix
}
karalabe commented 6 years ago

@fjl

fjl commented 5 years ago

p2p/discv5 is not compatible with discovery versions 3 and 4.