mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
update comment on MinimumChainWork check
This commit is contained in:
parent
c20a5ce106
commit
632ae47372
1 changed files with 3 additions and 7 deletions
|
@ -4142,13 +4142,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
// Note that if we were to be on a chain that forks from the checkpointed
|
// Don't serve headers from our active chain until our chainwork is at least
|
||||||
// chain, then serving those headers to a peer that has seen the
|
// the minimum chain work. This prevents us from starting a low-work headers
|
||||||
// checkpointed chain would cause that peer to disconnect us. Requiring
|
// sync that will inevitably be aborted by our peer.
|
||||||
// that our chainwork exceed the minimum chain work is a protection against
|
|
||||||
// being fed a bogus chain when we started up for the first time and
|
|
||||||
// getting partitioned off the honest network for serving that chain to
|
|
||||||
// others.
|
|
||||||
if (m_chainman.ActiveTip() == nullptr ||
|
if (m_chainman.ActiveTip() == nullptr ||
|
||||||
(m_chainman.ActiveTip()->nChainWork < m_chainman.MinimumChainWork() && !pfrom.HasPermission(NetPermissionFlags::Download))) {
|
(m_chainman.ActiveTip()->nChainWork < m_chainman.MinimumChainWork() && !pfrom.HasPermission(NetPermissionFlags::Download))) {
|
||||||
LogDebug(BCLog::NET, "Ignoring getheaders from peer=%d because active chain has too little work; sending empty response\n", pfrom.GetId());
|
LogDebug(BCLog::NET, "Ignoring getheaders from peer=%d because active chain has too little work; sending empty response\n", pfrom.GetId());
|
||||||
|
|
Loading…
Add table
Reference in a new issue