Class SeedPeers

  • All Implemented Interfaces:
    PeerDiscovery

    public class SeedPeers
    extends java.lang.Object
    implements PeerDiscovery
    SeedPeers stores a pre-determined list of Bitcoin node addresses. These nodes are selected based on being active on the network for a long period of time. The intention is to be a last resort way of finding a connection to the network, in case IRC and DNS fail. The list comes from the Bitcoin C++ source code.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.InetSocketAddress getPeer()
      Acts as an iterator, returning the address of each node in the list sequentially.
      java.util.List<java.net.InetSocketAddress> getPeers​(long services, java.time.Duration timeout)
      Returns all the Bitcoin nodes within the list.
      void shutdown()
      Stops any discovery in progress when we want to shut down quickly.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SeedPeers

        public SeedPeers​(java.net.InetSocketAddress[] seedAddrs)
        Supports finding peers by IP addresses/ports
        Parameters:
        seedAddrs - IP addresses/ports of seeds.
      • SeedPeers

        @Deprecated
        public SeedPeers​(int[] seedAddrInts,
                         NetworkParameters params)
        Supports finding peers by IP addresses
        Parameters:
        seedAddrInts - IP addresses for seed addresses.
        params - Network parameters to be used for port information.
    • Method Detail

      • getPeer

        @Nullable
        public java.net.InetSocketAddress getPeer()
        Acts as an iterator, returning the address of each node in the list sequentially. Once all the list has been iterated, null will be returned for each subsequent query.
        Returns:
        InetSocketAddress - The address/port of the next node.
      • getPeers

        public java.util.List<java.net.InetSocketAddress> getPeers​(long services,
                                                                   java.time.Duration timeout)
        Returns all the Bitcoin nodes within the list.
        Specified by:
        getPeers in interface PeerDiscovery
        Parameters:
        services - ignored
        timeout - ignored
        Returns:
        the pre-determined list of peers
      • shutdown

        public void shutdown()
        Description copied from interface: PeerDiscovery
        Stops any discovery in progress when we want to shut down quickly.
        Specified by:
        shutdown in interface PeerDiscovery