@Override public Integer getblockcount() { return peerGroup.getMostCommonChainHeight(); }
/** * Returns our peers most commonly reported chain height. If multiple heights are tied, the highest is returned. * If no peers are connected, returns zero. */ public int getMostCommonChainHeight() { lock.lock(); try { return getMostCommonChainHeight(this.peers); } finally { lock.unlock(); } }
/** * Returns our peers most commonly reported chain height. If multiple heights are tied, the highest is returned. * If no peers are connected, returns zero. */ public int getMostCommonChainHeight() { lock.lock(); try { return getMostCommonChainHeight(this.peers); } finally { lock.unlock(); } }
/** * Returns our peers most commonly reported chain height. If multiple heights are tied, the highest is returned. * If no peers are connected, returns zero. */ public int getMostCommonChainHeight() { lock.lock(); try { return getMostCommonChainHeight(this.peers); } finally { lock.unlock(); } }
/** * Returns our peers most commonly reported chain height. If multiple heights are tied, the highest is returned. * If no peers are connected, returns zero. */ public int getMostCommonChainHeight() { lock.lock(); try { return getMostCommonChainHeight(this.peers); } finally { lock.unlock(); } }
@Scheduled(fixedRate = 60000) public void reportBitcoinPeersConnected() { int amountConnectedPeers = bitcoinPeerGroup.numConnectedPeers(); int mostCommonChainHeight = bitcoinPeerGroup.getMostCommonChainHeight(); int bestChainHeight = bitcoinBlockchain.getBestChainHeight(); LOG.info("Bitcoin PeerGroup: amountConnectedPeers={} mostCommonChainHeight={} bestChainHeight={}", amountConnectedPeers, mostCommonChainHeight, bestChainHeight); } }
return null; int mostCommonChainHeight = getMostCommonChainHeight(peers); List<Peer> candidates = new ArrayList<Peer>(); for (Peer peer : peers) {
return null; int mostCommonChainHeight = getMostCommonChainHeight(peers); List<Peer> candidates = new ArrayList<Peer>(); for (Peer peer : peers) {
return null; int mostCommonChainHeight = getMostCommonChainHeight(peers); List<Peer> candidates = new ArrayList<>(); for (Peer peer : peers) {
return null; int mostCommonChainHeight = getMostCommonChainHeight(peers); List<Peer> candidates = new ArrayList<>(); for (Peer peer : peers) {
boolean behindPeers = chain != null && chain.getBestChainHeight() < getMostCommonChainHeight(); if (!behindPeers) syncDone = true;
boolean behindPeers = chain != null && chain.getBestChainHeight() < getMostCommonChainHeight(); if (!behindPeers) syncDone = true;
boolean behindPeers = chain != null && chain.getBestChainHeight() < getMostCommonChainHeight(); if (!behindPeers) syncDone = true;
boolean behindPeers = chain != null && chain.getBestChainHeight() < getMostCommonChainHeight(); if (!behindPeers) syncDone = true;
if (height != peerGroup.getMostCommonChainHeight()) { str = height + " \u2022 ";
assertNull(peerGroup.getDownloadPeer()); Peer a = connectPeer(1, versionMessage2).peer; assertEquals(2, peerGroup.getMostCommonChainHeight()); assertEquals(a, peerGroup.getDownloadPeer()); connectPeer(2, versionMessage2); assertEquals(2, peerGroup.getMostCommonChainHeight()); assertEquals(2, peerGroup.getMostCommonChainHeight()); assertEquals(3, peerGroup.getMostCommonChainHeight());