Class: Bitcoin::Network::PeerDiscovery

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin/network/peer_discovery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ PeerDiscovery

Returns a new instance of PeerDiscovery.



8
9
10
11
# File 'lib/bitcoin/network/peer_discovery.rb', line 8

def initialize(configuration)
  @logger = Bitcoin::Logger.create(:debug)
  @configuration = configuration
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



6
7
8
# File 'lib/bitcoin/network/peer_discovery.rb', line 6

def configuration
  @configuration
end

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/bitcoin/network/peer_discovery.rb', line 6

def logger
  @logger
end

Instance Method Details

#peersObject

get peer addresses, from DNS seeds.



14
15
16
17
# File 'lib/bitcoin/network/peer_discovery.rb', line 14

def peers
  # TODO add find from previous connected peer at first.
  (find_from_dns_seeds + seeds).uniq
end