mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
Remove NumBlocksOfPeers
Generally useless information. Only updates on connect time, not after that. Peers can easily lie and the median filter is not effective in preventing that. In the past it was used for progress display in the GUI but `CheckPoints::guessVerificationProgress` provides a better way that is now used. It was too easy to mislead it. Peers do lie about it in practice, see issue #4065. From the RPC, `getpeerinfo` gives the peer raw values, which are more useful.
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@@ -54,8 +54,6 @@ int64_t CTransaction::nMinTxFee = 10000; // Override with -mintxfee
|
||||
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying and mining) */
|
||||
int64_t CTransaction::nMinRelayTxFee = 1000;
|
||||
|
||||
static CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have
|
||||
|
||||
struct COrphanBlock {
|
||||
uint256 hashBlock;
|
||||
uint256 hashPrev;
|
||||
@@ -1303,12 +1301,6 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return maximum amount of blocks that other nodes claim to have
|
||||
int GetNumBlocksOfPeers()
|
||||
{
|
||||
return std::max(cPeerBlockCounts.median(), Checkpoints::GetTotalBlocksEstimate());
|
||||
}
|
||||
|
||||
bool IsInitialBlockDownload()
|
||||
{
|
||||
LOCK(cs_main);
|
||||
@@ -3488,9 +3480,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
LogPrintf("receive version message: %s: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", pfrom->cleanSubVer, pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString(), addrFrom.ToString(), pfrom->addr.ToString());
|
||||
|
||||
AddTimeData(pfrom->addr, nTime);
|
||||
|
||||
LOCK(cs_main);
|
||||
cPeerBlockCounts.input(pfrom->nStartingHeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user