diff options
author | glozow <gloriajzhao@gmail.com> | 2022-09-27 10:54:16 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2022-09-27 11:02:44 +0100 |
commit | 9fcdb9f3a044330d3d7515fa35709102c98534d2 (patch) | |
tree | 66369def7ad2df35d48edc95354169c3705ec060 | |
parent | eeac05aa2251aee22888000ec78f6143f28b4d23 (diff) | |
parent | bdcafb913398f0cdaff9c880618f9ebfc85c7693 (diff) |
Merge bitcoin/bitcoin#26172: p2p: ProcessHeadersMessage(): fix received_new_header
bdcafb913398f0cdaff9c880618f9ebfc85c7693 p2p: ProcessHeadersMessage(): fix received_new_header (Larry Ruane)
Pull request description:
Follow-up to #25717. The commit "Utilize anti-DoS headers download strategy" changed how this bool variable is computed, so that its value is now the opposite of what it should be.
Prior to #25717:
```
bool received_new_header{WITH_LOCK(::cs_main, return m_chainman.m_blockman.LookupBlockIndex(headers.back().GetHash()) == nullptr)};
```
After #25717 (simplified):
```
{
LOCK(cs_main);
last_received_header = m_chainman.m_blockman.LookupBlockIndex(headers.back().GetHash());
}
bool received_new_header{last_received_header != nullptr};
```
ACKs for top commit:
dergoegge:
ACK bdcafb913398f0cdaff9c880618f9ebfc85c7693
glozow:
ACK bdcafb913398f0cdaff9c880618f9ebfc85c7693, I believe this is correct and don't see anything to suggest the switch was intentional.
stickies-v:
ACK bdcafb913398f0cdaff9c880618f9ebfc85c7693
Tree-SHA512: 35c12762f1429585a0b1c15053e310e83efb28c3d8cbf4092fad9fe81c893f6d766df1f2b20624882acb9654d0539a0c871f587d7090dc2a198115adf59db3ec
-rw-r--r-- | src/net_processing.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 10952d8111..eca6263392 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2846,7 +2846,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, Peer& peer, // If we don't have the last header, then this peer will have given us // something new (if these headers are valid). - bool received_new_header{last_received_header != nullptr}; + bool received_new_header{last_received_header == nullptr}; // Now process all the headers. BlockValidationState state; |