|
|
@ -491,17 +491,17 @@ struct CNodeState {
|
|
|
|
//! The peer's address
|
|
|
|
//! The peer's address
|
|
|
|
const CService address;
|
|
|
|
const CService address;
|
|
|
|
//! The best known block we know this peer has announced.
|
|
|
|
//! The best known block we know this peer has announced.
|
|
|
|
const CBlockIndex *pindexBestKnownBlock;
|
|
|
|
const CBlockIndex* pindexBestKnownBlock{nullptr};
|
|
|
|
//! The hash of the last unknown block this peer has announced.
|
|
|
|
//! The hash of the last unknown block this peer has announced.
|
|
|
|
uint256 hashLastUnknownBlock;
|
|
|
|
uint256 hashLastUnknownBlock{};
|
|
|
|
//! The last full block we both have.
|
|
|
|
//! The last full block we both have.
|
|
|
|
const CBlockIndex *pindexLastCommonBlock;
|
|
|
|
const CBlockIndex* pindexLastCommonBlock{nullptr};
|
|
|
|
//! The best header we have sent our peer.
|
|
|
|
//! The best header we have sent our peer.
|
|
|
|
const CBlockIndex *pindexBestHeaderSent;
|
|
|
|
const CBlockIndex* pindexBestHeaderSent{nullptr};
|
|
|
|
//! Length of current-streak of unconnecting headers announcements
|
|
|
|
//! Length of current-streak of unconnecting headers announcements
|
|
|
|
int nUnconnectingHeaders;
|
|
|
|
int nUnconnectingHeaders{0};
|
|
|
|
//! Whether we've started headers synchronization with this peer.
|
|
|
|
//! Whether we've started headers synchronization with this peer.
|
|
|
|
bool fSyncStarted;
|
|
|
|
bool fSyncStarted{false};
|
|
|
|
//! When to potentially disconnect peer for stalling headers download
|
|
|
|
//! When to potentially disconnect peer for stalling headers download
|
|
|
|
std::chrono::microseconds m_headers_sync_timeout{0us};
|
|
|
|
std::chrono::microseconds m_headers_sync_timeout{0us};
|
|
|
|
//! Since when we're stalling block download progress (in microseconds), or 0.
|
|
|
|
//! Since when we're stalling block download progress (in microseconds), or 0.
|
|
|
@ -509,29 +509,29 @@ struct CNodeState {
|
|
|
|
std::list<QueuedBlock> vBlocksInFlight;
|
|
|
|
std::list<QueuedBlock> vBlocksInFlight;
|
|
|
|
//! When the first entry in vBlocksInFlight started downloading. Don't care when vBlocksInFlight is empty.
|
|
|
|
//! When the first entry in vBlocksInFlight started downloading. Don't care when vBlocksInFlight is empty.
|
|
|
|
std::chrono::microseconds m_downloading_since{0us};
|
|
|
|
std::chrono::microseconds m_downloading_since{0us};
|
|
|
|
int nBlocksInFlight;
|
|
|
|
int nBlocksInFlight{0};
|
|
|
|
int nBlocksInFlightValidHeaders;
|
|
|
|
int nBlocksInFlightValidHeaders{0};
|
|
|
|
//! Whether we consider this a preferred download peer.
|
|
|
|
//! Whether we consider this a preferred download peer.
|
|
|
|
bool fPreferredDownload;
|
|
|
|
bool fPreferredDownload{false};
|
|
|
|
//! Whether this peer wants invs or headers (when possible) for block announcements.
|
|
|
|
//! Whether this peer wants invs or headers (when possible) for block announcements.
|
|
|
|
bool fPreferHeaders;
|
|
|
|
bool fPreferHeaders{false};
|
|
|
|
//! Whether this peer wants invs or cmpctblocks (when possible) for block announcements.
|
|
|
|
//! Whether this peer wants invs or cmpctblocks (when possible) for block announcements.
|
|
|
|
bool fPreferHeaderAndIDs;
|
|
|
|
bool fPreferHeaderAndIDs{false};
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Whether this peer will send us cmpctblocks if we request them.
|
|
|
|
* Whether this peer will send us cmpctblocks if we request them.
|
|
|
|
* This is not used to gate request logic, as we really only care about fSupportsDesiredCmpctVersion,
|
|
|
|
* This is not used to gate request logic, as we really only care about fSupportsDesiredCmpctVersion,
|
|
|
|
* but is used as a flag to "lock in" the version of compact blocks (fWantsCmpctWitness) we send.
|
|
|
|
* but is used as a flag to "lock in" the version of compact blocks (fWantsCmpctWitness) we send.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool fProvidesHeaderAndIDs;
|
|
|
|
bool fProvidesHeaderAndIDs{false};
|
|
|
|
//! Whether this peer can give us witnesses
|
|
|
|
//! Whether this peer can give us witnesses
|
|
|
|
bool fHaveWitness;
|
|
|
|
bool fHaveWitness{false};
|
|
|
|
//! Whether this peer wants witnesses in cmpctblocks/blocktxns
|
|
|
|
//! Whether this peer wants witnesses in cmpctblocks/blocktxns
|
|
|
|
bool fWantsCmpctWitness;
|
|
|
|
bool fWantsCmpctWitness{false};
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* If we've announced NODE_WITNESS to this peer: whether the peer sends witnesses in cmpctblocks/blocktxns,
|
|
|
|
* If we've announced NODE_WITNESS to this peer: whether the peer sends witnesses in cmpctblocks/blocktxns,
|
|
|
|
* otherwise: whether this peer sends non-witnesses in cmpctblocks/blocktxns.
|
|
|
|
* otherwise: whether this peer sends non-witnesses in cmpctblocks/blocktxns.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool fSupportsDesiredCmpctVersion;
|
|
|
|
bool fSupportsDesiredCmpctVersion{false};
|
|
|
|
|
|
|
|
|
|
|
|
/** State used to enforce CHAIN_SYNC_TIMEOUT and EXTRA_PEER_CHECK_INTERVAL logic.
|
|
|
|
/** State used to enforce CHAIN_SYNC_TIMEOUT and EXTRA_PEER_CHECK_INTERVAL logic.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -568,13 +568,13 @@ struct CNodeState {
|
|
|
|
bool m_protect;
|
|
|
|
bool m_protect;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ChainSyncTimeoutState m_chain_sync;
|
|
|
|
ChainSyncTimeoutState m_chain_sync{0, nullptr, false, false};
|
|
|
|
|
|
|
|
|
|
|
|
//! Time of last new block announcement
|
|
|
|
//! Time of last new block announcement
|
|
|
|
int64_t m_last_block_announcement;
|
|
|
|
int64_t m_last_block_announcement{0};
|
|
|
|
|
|
|
|
|
|
|
|
//! Whether this peer is an inbound connection
|
|
|
|
//! Whether this peer is an inbound connection
|
|
|
|
bool m_is_inbound;
|
|
|
|
const bool m_is_inbound;
|
|
|
|
|
|
|
|
|
|
|
|
//! A rolling bloom filter of all announced tx CInvs to this peer.
|
|
|
|
//! A rolling bloom filter of all announced tx CInvs to this peer.
|
|
|
|
CRollingBloomFilter m_recently_announced_invs = CRollingBloomFilter{INVENTORY_MAX_RECENT_RELAY, 0.000001};
|
|
|
|
CRollingBloomFilter m_recently_announced_invs = CRollingBloomFilter{INVENTORY_MAX_RECENT_RELAY, 0.000001};
|
|
|
@ -585,23 +585,6 @@ struct CNodeState {
|
|
|
|
CNodeState(CAddress addrIn, bool is_inbound)
|
|
|
|
CNodeState(CAddress addrIn, bool is_inbound)
|
|
|
|
: address(addrIn), m_is_inbound(is_inbound)
|
|
|
|
: address(addrIn), m_is_inbound(is_inbound)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pindexBestKnownBlock = nullptr;
|
|
|
|
|
|
|
|
hashLastUnknownBlock.SetNull();
|
|
|
|
|
|
|
|
pindexLastCommonBlock = nullptr;
|
|
|
|
|
|
|
|
pindexBestHeaderSent = nullptr;
|
|
|
|
|
|
|
|
nUnconnectingHeaders = 0;
|
|
|
|
|
|
|
|
fSyncStarted = false;
|
|
|
|
|
|
|
|
nBlocksInFlight = 0;
|
|
|
|
|
|
|
|
nBlocksInFlightValidHeaders = 0;
|
|
|
|
|
|
|
|
fPreferredDownload = false;
|
|
|
|
|
|
|
|
fPreferHeaders = false;
|
|
|
|
|
|
|
|
fPreferHeaderAndIDs = false;
|
|
|
|
|
|
|
|
fProvidesHeaderAndIDs = false;
|
|
|
|
|
|
|
|
fHaveWitness = false;
|
|
|
|
|
|
|
|
fWantsCmpctWitness = false;
|
|
|
|
|
|
|
|
fSupportsDesiredCmpctVersion = false;
|
|
|
|
|
|
|
|
m_chain_sync = { 0, nullptr, false, false };
|
|
|
|
|
|
|
|
m_last_block_announcement = 0;
|
|
|
|
|
|
|
|
m_recently_announced_invs.reset();
|
|
|
|
m_recently_announced_invs.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|