btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.24k stars 2.37k forks source link

Ban on wire protocol error[s] #774

Open dajohi opened 8 years ago

dajohi commented 8 years ago

btcd should ban hosts that do not follow the wire protocol. For developers needing to test, a --whitelist option should be available.

Roasbeef commented 8 years ago

We'd want to be careful to ensure that peers which send us new wire messages we don't yet understand are exempt from this banning. With the addition of BIP 151, peers may attempt to optimistically set up an encrypted session within the active connection before version negotiation. If we ban based on an unknown message (since we haven't implemented this yet), then we'd erroneously be dropping peers within the network that support the new encryption features. FWIW, the only implementation I'm aware of that has implemented BIP 151 is bcoin.

On a related, note it's puzzling as to why BIP 151 didn't include a new service bit, or a bump in p2p protocol version. Either of those signals would avoid the scenario of a peer sending a message to another peer with uncertainty as to if they're able to process/recognize the message.