This PR removes m_getaddr_sent, as it no longer behaves as originally intended. Initially, this flag was meant to track when a getaddr message was sent to a peer.
Now that self-announcements are sent separately from getaddr responses, the self-announcement sets m_getaddr_sent to false even though we are still waiting for the getaddr response (1000 addresses).
When the getaddr response does arrive, we rely on the size of the addr message, not the flag, to decide whether it should be relayed. This makes the flag redundant.
This is the current behavior:
- The initial self-announcement is not relayed but it flips m_getaddr_sent to be false
- We use addr.size() to avoid relaying (1000) getaddr response.(assuming the other two flags are false)
- The first addr message is relayed because the flag is false(this was not the case before #34146).
Removing this flag ensures that:
- The initial self-announcement is relayed.
- The getaddr response is still not relayed, using the existing size-based check.
I had initially considered an alternative approach https://github.com/naiyoma/bitcoin/pull/14, where the self-announcement would not affect this flag and would therefore retain the initial behaviour, but i decided to reattempt its removal, as this was previously attempted, see #19794. Given the changes since then, I believe revisiting it is now more appropriate.