Skip to content

Commit

Permalink
Re-add address seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
pokkst committed Apr 4, 2021
1 parent 61246bb commit d709c55
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 22 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/bitcoinj/core/NetworkParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public abstract class NetworkParameters {
protected int subsidyDecreaseBlockCount;

protected String[] dnsSeeds;
protected int[] addrSeeds;
protected String[] addrSeeds;
protected HttpDiscovery.Details[] httpSeeds = {};
protected Map<Integer, Sha256Hash> checkpoints = new HashMap<>();
protected volatile transient MessageSerializer defaultSerializer = null;
Expand Down Expand Up @@ -353,7 +353,7 @@ public int getDefaultPeerCount() {
/**
* Returns IP address of active peers.
*/
public int[] getAddrSeeds() {
public String[] getAddrSeeds() {
return addrSeeds;
}

Expand Down
8 changes: 7 additions & 1 deletion core/src/main/java/org/bitcoinj/kits/WalletKitCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bitcoinj.net.*;
import org.bitcoinj.net.discovery.DnsDiscovery;
import org.bitcoinj.net.discovery.PeerDiscovery;
import org.bitcoinj.net.discovery.SeedPeers;
import org.bitcoinj.protocols.payments.slp.SlpPaymentSession;
import org.bitcoinj.script.Script;
import org.bitcoinj.store.BlockStore;
Expand Down Expand Up @@ -425,7 +426,12 @@ protected void startUp() throws Exception {
vPeerGroup.setMaxConnections(peerAddresses.length);
peerAddresses = null;
} else if (!params.getId().equals(NetworkParameters.ID_REGTEST)) {
vPeerGroup.addPeerDiscovery(discovery != null ? discovery : new DnsDiscovery(params));
if(discovery != null) {
vPeerGroup.addPeerDiscovery(discovery);
} else {
vPeerGroup.addPeerDiscovery(new DnsDiscovery(params));
vPeerGroup.addPeerDiscovery(new SeedPeers(params));
}
}
vChain.addWallet(vWallet);
vPeerGroup.addWallet(vWallet);
Expand Down
17 changes: 5 additions & 12 deletions core/src/main/java/org/bitcoinj/net/discovery/SeedPeers.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class SeedPeers implements PeerDiscovery {
private NetworkParameters params;
private int[] seedAddrs;
private String[] seedAddrs;
private int pnseedIndex;

/**
Expand All @@ -52,7 +52,7 @@ public SeedPeers(NetworkParameters params) {
* @param seedAddrs IP addresses for seed addresses.
* @param params Network parameters to be used for port information.
*/
public SeedPeers(int[] seedAddrs, NetworkParameters params) {
public SeedPeers(String[] seedAddrs, NetworkParameters params) {
this.seedAddrs = seedAddrs;
this.params = params;
}
Expand All @@ -77,9 +77,8 @@ public InetSocketAddress getPeer() throws PeerDiscoveryException {
private InetSocketAddress nextPeer() throws UnknownHostException, PeerDiscoveryException {
if (seedAddrs == null || seedAddrs.length == 0)
throw new PeerDiscoveryException("No IP address seeds configured; unable to find any peers");

if (pnseedIndex >= seedAddrs.length) return null;
return new InetSocketAddress(convertAddress(seedAddrs[pnseedIndex++]),
return new InetSocketAddress(seedAddrs[pnseedIndex++],
params.getPort());
}

Expand All @@ -99,18 +98,12 @@ public List<InetSocketAddress> getPeers(long services, long timeoutValue, TimeUn

private List<InetSocketAddress> allPeers() throws UnknownHostException {
List<InetSocketAddress> addresses = new ArrayList<>(seedAddrs.length);
for (int seedAddr : seedAddrs) {
addresses.add(new InetSocketAddress(convertAddress(seedAddr), params.getPort()));
for (String seedAddr : seedAddrs) {
addresses.add(new InetSocketAddress(seedAddr, params.getPort()));
}
return addresses;
}

private InetAddress convertAddress(int seed) throws UnknownHostException {
byte[] v4addr = new byte[4];
Utils.uint32ToByteArrayLE(seed, v4addr, 0);
return InetAddress.getByAddress(v4addr);
}

@Override
public void shutdown() {
}
Expand Down
229 changes: 227 additions & 2 deletions core/src/main/java/org/bitcoinj/params/MainNetParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,236 @@ public MainNetParams() {
dnsSeeds = new String[]{
"seed-bch.bitcoinforks.org",
"seed.bchd.cash",
"btccash-seeder.bitcoinunlimited.info"
"btccash-seeder.bitcoinunlimited.info",
"seed.flowee.cash",
"bchseed.c3-soft.com",
"dnsseed.electroncash.de",
"seed.bch.loping.net"
};

httpSeeds = null;
addrSeeds = null;
addrSeeds = new String[] {
"2.37.183.149",
"3.135.187.10",
"3.210.96.9",
"5.103.137.146",
"5.189.153.133",
"5.39.122.17",
"5.44.97.110",
"5.56.40.1",
"5.9.29.54",
"13.125.221.9",
"13.230.85.140",
"13.90.141.13",
"14.161.3.136",
"18.156.62.142",
"18.223.164.123",
"23.152.0.196",
"24.192.60.220",
"31.220.56.195",
"31.25.241.224",
"34.225.107.142",
"34.243.19.193",
"34.244.188.218",
"34.92.81.124",
"35.193.218.253",
"35.208.109.181",
"35.209.3.16",
"35.240.221.90",
"37.123.153.205",
"37.221.209.222",
"38.143.66.118",
"38.87.54.163",
"39.105.126.134",
"39.97.177.55",
"45.151.125.24",
"45.32.79.103",
"45.77.12.99",
"45.89.16.17",
"46.103.251.160",
"46.165.221.209",
"46.166.142.52",
"47.221.138.240",
"47.254.128.149",
"47.62.61.88",
"47.94.39.87",
"50.39.245.26",
"51.15.106.21",
"52.168.133.140",
"52.203.66.52",
"52.246.166.192",
"52.71.89.175",
"52.82.19.10",
"54.152.182.25",
"59.110.4.119",
"60.249.215.224",
"61.124.151.159",
"61.18.151.142",
"62.210.110.181",
"62.42.138.162",
"66.151.242.154",
"66.187.65.6",
"66.42.74.250",
"66.96.199.249",
"67.239.3.146",
"68.183.76.215",
"70.67.146.45",
"71.139.127.73",
"71.67.65.230",
"71.84.210.207",
"71.93.32.247",
"72.183.35.18",
"72.196.128.193",
"76.84.79.211",
"77.120.122.114",
"78.34.126.50",
"78.97.206.149",
"79.55.30.190",
"80.179.226.48",
"80.195.243.45",
"81.169.251.124",
"82.117.166.77",
"82.200.205.30",
"82.221.107.216",
"83.221.211.116",
"84.213.188.64",
"84.44.234.220",
"85.10.201.15",
"85.148.14.160",
"85.209.240.92",
"85.64.35.122",
"87.144.183.22",
"88.198.33.214",
"88.208.3.195",
"89.132.239.57",
"89.160.113.174",
"89.163.148.121",
"89.179.247.236",
"89.40.7.97",
"89.7.25.196",
"91.121.163.195",
"91.197.44.144",
"92.42.104.13",
"93.104.208.119",
"93.238.101.168",
"93.90.193.195",
"94.130.16.96",
"94.19.73.106",
"94.244.97.244",
"94.247.134.186",
"95.216.12.173",
"95.63.229.41",
"96.126.117.5",
"100.11.132.241",
"101.92.39.116",
"102.68.86.49",
"103.230.185.4",
"104.154.189.24",
"104.196.255.91",
"104.238.131.116",
"106.167.197.33",
"107.172.9.209",
"107.174.70.250",
"107.191.117.175",
"108.173.48.152",
"109.145.47.158",
"109.195.150.106",
"111.90.151.48",
"117.20.65.54",
"119.3.248.108",
"121.199.59.128",
"121.254.175.27",
"134.209.81.251",
"136.144.215.219",
"138.201.222.217",
"138.68.249.47",
"139.162.21.80",
"142.68.82.226",
"144.76.44.57",
"149.210.238.31",
"152.136.23.15",
"155.138.192.228",
"158.177.186.55",
"162.220.47.150",
"162.242.168.55",
"162.62.21.182",
"167.172.41.140",
"168.235.72.196",
"170.52.71.98",
"172.104.34.214",
"172.249.77.148",
"172.93.133.119",
"173.208.203.82",
"173.212.193.23",
"173.79.129.114",
"173.94.50.107",
"174.141.196.204",
"175.176.142.110",
"176.223.137.37",
"177.38.215.9",
"178.218.111.250",
"178.59.34.4",
"178.63.88.4",
"179.218.90.235",
"183.111.234.221",
"185.107.80.1",
"185.25.60.199",
"185.26.28.171",
"185.50.37.171",
"185.81.164.38",
"188.20.184.122",
"188.226.150.166",
"188.40.93.205",
"188.66.26.61",
"189.211.146.140",
"190.2.130.27",
"192.187.121.43",
"192.30.89.142",
"192.81.220.210",
"193.135.10.215",
"193.138.218.67",
"193.169.244.189",
"193.29.187.78",
"194.14.246.205",
"194.149.90.19",
"194.99.21.135",
"195.122.150.173",
"195.154.168.129",
"195.181.240.229",
"198.204.229.34",
"198.27.83.210",
"198.50.179.86",
"203.173.116.34",
"206.124.149.67",
"209.160.33.233",
"210.242.27.237",
"211.32.117.106",
"211.43.8.168",
"211.63.212.26",
"212.32.230.219",
"213.202.212.78",
"213.232.124.121",
"216.108.236.180",
"217.117.29.71",
"217.160.169.226",
"217.217.55.14",
"217.31.166.123",
"[2001:470:8f9e:944:5054:ff:fed7:c164]",
"[2001:67c:2b8c:1:225:90ff:fe54:5306]",
"[2604:180:f4::61]",
"[2604:e880:0:15:ec4:7aff:fe4a:40e1]",
"[2a00:1768:2001:27::a1cb]",
"[2a00:7c80:0:10b::4ad9]",
"[2a01:5f0:beef:5:0:3:0:1]",
"[2a01:7a0:2:137a::9]",
"[2a02:4780:1:1::1:884a]",
"[2a02:7b40:b0df:8925::1]",
"[2a02:a311:8143:8c00::4]",
"[2a03:1b20:1:f410:40::acef]",
"[2a04:2180:1:11:f000::16]",
"[2a0a:51c0:0:136::4]",
"[2c0f:f598:6::54f:c0fe]"
};

// Aug, 1 hard fork
uahfHeight = 478559;
Expand Down
10 changes: 9 additions & 1 deletion core/src/main/java/org/bitcoinj/params/ScaleNetParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,22 @@ public ScaleNetParams() {

checkpoints.put(0, Sha256Hash.wrap(genesisHash));
checkpoints.put(45, Sha256Hash.wrap("00000000d75a7c9098d02b321e9900b16ecbd552167e65683fe86e5ecf88b320"));
checkpoints.put(10000, Sha256Hash.wrap("00000000b711dc753130e5083888d106f99b920b1b8a492eb5ac41d40e482905"));

dnsSeeds = new String[]{
"scalenet-seed-bch.bitcoinforks.org",
"scalenet-seed-bch.toom.im",
"seed.sbch.loping.net"
};
httpSeeds = null;
addrSeeds = null;
addrSeeds = new String[] {
"66.172.112.151",
"66.172.112.154",
"66.172.112.251",
"66.172.112.252",
"45.33.41.87",
"193.135.10.219"
};
bip32HeaderP2PKHpub = 0x043587cf; // The 4 byte header that serializes in base58 to "tpub".
bip32HeaderP2PKHpriv = 0x04358394; // The 4 byte header that serializes in base58 to "tprv"

Expand Down
Loading

0 comments on commit d709c55

Please sign in to comment.