bisq-network / bisq

A decentralized bitcoin exchange network
https://bisq.network
GNU Affero General Public License v3.0
4.72k stars 1.27k forks source link

Our BitcoinJ fork sometimes fails to connect because of deprecated BTC alert system #4080

Open dmos62 opened 4 years ago

dmos62 commented 4 years ago

In some cases BitcoinJ throws a ProtocolException, crashing the connection, because it receives an alert message during the handshake [0]. The alert message is sent because Bitcoin Core >= 0.14.0 is telling us to upgrade to atleast version 70012 [1][2].

It would be difficult to predict the consequences of changing the advertised version. We could just have BitcoinJ always ignore alert messages (which are deprecated and only useful/used for locking out very old clients). It seems that our fork already is attempting to do that, and the handshake case is an oversight.

I've discovered this when testing a local Bitcoin node that is set to prune. So far this is the only setup where I've received an alert message during handshake. I couldn't discover why.

[0] https://github.com/bisq-network/bitcoinj/blob/bisq_0.14.7/core/src/main/java/org/bitcoinj/core/Peer.java#L474 [1] https://github.com/bitcoin/bitcoin/commit/8ff8d219c3d9a0b6f604bb99ca4a27ad77cdb69b [2] https://en.bitcoin.it/wiki/Alert_system

wiz commented 4 years ago

Yeah, it also reproduces if you ./bisq-desktop --baseCurrencyNetwork=BTC_TESTNET