[refactor] Restructure logic to check for addr relay.

We previously identified if we relay addresses to the connection by checking
for the existence of the m_addr_known data structure. With this commit, we
answer this question based on the connection type.

IsAddrRelayPeer() checked for the existence of the m_addr_known
This commit is contained in:
Amiti Uttarwar
2020-08-10 14:48:54 -07:00
parent a6ab1e81f9
commit dff16b184b
4 changed files with 17 additions and 11 deletions

View File

@@ -861,6 +861,12 @@ public:
return m_conn_type == ConnectionType::INBOUND;
}
/* Whether we send addr messages over this connection */
bool RelayAddrsWithConn() const
{
return m_conn_type != ConnectionType::BLOCK_RELAY;
}
bool ExpectServicesFromConn() const {
switch(m_conn_type) {
case ConnectionType::INBOUND:
@@ -891,8 +897,6 @@ public:
std::chrono::microseconds m_next_addr_send GUARDED_BY(cs_sendProcessing){0};
std::chrono::microseconds m_next_local_addr_send GUARDED_BY(cs_sendProcessing){0};
bool IsAddrRelayPeer() const { return m_addr_known != nullptr; }
// List of block ids we still have announce.
// There is no final sorting before sending, as they are always sent immediately
// and in the order requested.