mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-17 19:10:40 +01:00
Merge #10387: Eventually connect to NODE_NETWORK_LIMITED peers
eb91835Add setter for g_initial_block_download_completed (Jonas Schnelli)3f56df5[QA] add NODE_NETWORK_LIMITED address relay and sync test (Jonas Schnelli)158e1a6[QA] fix mininode CAddress ser/deser (Jonas Schnelli)fa999af[QA] Allow addrman loopback tests (add debug option -addrmantest) (Jonas Schnelli)6fe57bdConnect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD (Jonas Schnelli)31c45a9Accept addresses with NODE_NETWORK_LIMITED flag (Jonas Schnelli) Pull request description: Eventually connect to peers signalling NODE_NETWORK_LIMITED if we are out of IBD. Accept and relay NODE_NETWORK_LIMITED peers in addrman. Tree-SHA512: 8a238fc97f767f81cae1866d6cc061390f23a72af4a711d2f7158c77f876017986abb371d213d1c84019eef7be4ca951e8e6f83fda36769c4e1a1d763f787037
This commit is contained in:
@@ -892,6 +892,7 @@ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CB
|
||||
const int nNewHeight = pindexNew->nHeight;
|
||||
connman->SetBestHeight(nNewHeight);
|
||||
|
||||
SetServiceFlagsIBDCache(!fInitialDownload);
|
||||
if (!fInitialDownload) {
|
||||
// Find the hashes of all blocks that weren't previously in the best chain.
|
||||
std::vector<uint256> vHashes;
|
||||
@@ -1642,7 +1643,13 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
pfrom->cleanSubVer = cleanSubVer;
|
||||
}
|
||||
pfrom->nStartingHeight = nStartingHeight;
|
||||
pfrom->fClient = !(nServices & NODE_NETWORK);
|
||||
|
||||
// set nodes not relaying blocks and tx and not serving (parts) of the historical blockchain as "clients"
|
||||
pfrom->fClient = (!(nServices & NODE_NETWORK) && !(nServices & NODE_NETWORK_LIMITED));
|
||||
|
||||
// set nodes not capable of serving the complete blockchain history as "limited nodes"
|
||||
pfrom->m_limited_node = (!(nServices & NODE_NETWORK) && (nServices & NODE_NETWORK_LIMITED));
|
||||
|
||||
{
|
||||
LOCK(pfrom->cs_filter);
|
||||
pfrom->fRelayTxes = fRelay; // set to true after we get the first filter* message
|
||||
@@ -1801,7 +1808,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// We only bother storing full nodes, though this may include
|
||||
// things which we would not make an outbound connection to, in
|
||||
// part because we may make feeler connections to them.
|
||||
if (!MayHaveUsefulAddressDB(addr.nServices))
|
||||
if (!MayHaveUsefulAddressDB(addr.nServices) && !HasAllDesirableServiceFlags(addr.nServices))
|
||||
continue;
|
||||
|
||||
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
|
||||
@@ -3611,7 +3618,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic<bool>& interruptM
|
||||
// Message: getdata (blocks)
|
||||
//
|
||||
std::vector<CInv> vGetData;
|
||||
if (!pto->fClient && (fFetch || !IsInitialBlockDownload()) && state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
|
||||
if (!pto->fClient && ((fFetch && !pto->m_limited_node) || !IsInitialBlockDownload()) && state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
|
||||
std::vector<const CBlockIndex*> vToDownload;
|
||||
NodeId staller = -1;
|
||||
FindNextBlocksToDownload(pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - state.nBlocksInFlight, vToDownload, staller, consensusParams);
|
||||
|
||||
Reference in New Issue
Block a user