message: [test] Add address relay tests involving outbound peers
diff: @@ -94,6 +94,7 @@ class AddrTest(BitcoinTestFramework):
  self.nodes[0].disconnect_p2ps()
  def relay_tests(self):
  + self.log.info('Test address relay')
  self.log.info('Check that addr message content is relayed and added to addrman')
  addr_source = self.nodes[0].add_p2p_connection(P2PInterface())
  num_receivers = 7
  @@ -122,6 +123,35 @@ class AddrTest(BitcoinTestFramework):
  self.nodes[0].disconnect_p2ps()
  + self.log.info('Check relay of addresses received from outbound peers')
  + inbound_peer = self.nodes[0].add_p2p_connection(AddrReceiver())
  + full_outbound_peer = self.nodes[0].add_outbound_p2p_connection(GetAddrStore(), p2p_idx=0, connection_type="outbound-full-relay")
  + msg = self.setup_addr_msg(2)
  + self.send_addr_msg(full_outbound_peer, msg, [inbound_peer])
  + self.log.info('Check that the first addr message received from an outbound peer is not relayed')
  + # Currently, there is a flag that prevents the first addr message received
  + # from a new outbound peer to be relayed to others. Originally meant to prevent
  + # large GETADDR responses from being relayed, it now typically affects the self-announcement
  + # of the outbound peer which is often sent before the GETADDR response.
  + assert_equal(inbound_peer.num_ipv4_received, 0)
  +
  + self.log.info('Check that subsequent addr messages sent from an outbound peer are relayed')
  + msg2 = self.setup_addr_msg(2)
  + self.send_addr_msg(full_outbound_peer, msg2, [inbound_peer])
  + assert_equal(inbound_peer.num_ipv4_received, 2)
  +
  + self.log.info('Check address relay to outbound peers')
  + block_relay_peer = self.nodes[0].add_outbound_p2p_connection(GetAddrStore(), p2p_idx=1, connection_type="block-relay-only")
  + msg3 = self.setup_addr_msg(2)
  + self.send_addr_msg(inbound_peer, msg3, [full_outbound_peer, block_relay_peer])
  +
  + self.log.info('Check that addresses are relayed to full outbound peers')
  + assert_equal(full_outbound_peer.num_ipv4_received, 2)
  + self.log.info('Check that addresses are not relayed to block-relay-only outbound peers')
  + assert_equal(block_relay_peer.num_ipv4_received, 0)
  +
  + self.nodes[0].disconnect_p2ps()
  +
  def getaddr_tests(self):
  self.log.info('Test getaddr behavior')
  self.log.info('Check that we send a getaddr message upon connecting to an outbound-full-relay peer')
  