3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 14:54:15 +00:00

PeerGroup: make selectDownloadPeer non static so users can override it and control selection behaviour.

This commit is contained in:
Mike Hearn 2013-03-29 18:26:40 +00:00
parent 9e870f40bf
commit 616b4a5a7d

View File

@ -1316,8 +1316,11 @@ public class PeerGroup extends AbstractIdleService {
long pingTime;
}
/** Given a list of Peers, return a Peer to be used as the download peer. */
protected static Peer selectDownloadPeer(List<Peer> peers) {
/**
* Given a list of Peers, return a Peer to be used as the download peer. If you don't want PeerGroup to manage
* download peer statuses for you, just override this and always return null.
*/
protected Peer selectDownloadPeer(List<Peer> peers) {
// Characteristics to select for in order of importance:
// - Chain height is reasonable (majority of nodes)
// - High enough protocol version for the features we want (but we'll settle for less)