mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 15:26:03 -04:00
Use testnet and server seed as default, fix logs
This commit is contained in:
parent
020ceb15e9
commit
03f158f61d
@ -39,13 +39,14 @@ public class SeedNode extends Thread {
|
||||
public static void main(String[] args) {
|
||||
Peer peer = null;
|
||||
SeedNodeAddress.StaticSeedNodeAddresses seedNodeAddress = SeedNodeAddress.StaticSeedNodeAddresses
|
||||
.LOCALHOST;
|
||||
.DIGITAL_OCEAN1;
|
||||
try {
|
||||
peer = new PeerBuilder(Number160.createHash(seedNodeAddress.getId())).ports(seedNodeAddress.getPort())
|
||||
.start();
|
||||
new PeerBuilderDHT(peer).start();
|
||||
new PeerBuilderNAT(peer).start();
|
||||
log.debug("peer listening at port: {}", seedNodeAddress.getPort());
|
||||
|
||||
peer.peerBean().peerMap().addPeerMapChangeListener(new PeerMapChangeListener() {
|
||||
@Override
|
||||
public void peerInserted(PeerAddress peerAddress, boolean verified) {
|
||||
|
@ -32,7 +32,7 @@ public class BitcoinModule extends AbstractModule {
|
||||
private final BitcoinNetwork defaultNetwork;
|
||||
|
||||
public BitcoinModule(Properties properties) {
|
||||
this(properties, BitcoinNetwork.REGTEST);
|
||||
this(properties, BitcoinNetwork.TESTNET);
|
||||
}
|
||||
|
||||
public BitcoinModule(Properties properties, BitcoinNetwork defaultNetwork) {
|
||||
|
@ -191,12 +191,10 @@ public class BootstrappedPeerFactory {
|
||||
settableFuture.set(peerDHT);
|
||||
}
|
||||
else {
|
||||
log.warn("Discover has failed. Reason: " + futureDiscover.failedReason());
|
||||
setState("We are probably behind a NAT and not reachable to other peers. " +
|
||||
"We try port forwarding as next step.");
|
||||
|
||||
tryPortForwarding(peerDHT, futureDiscover);
|
||||
setState("Port forwarding has failed. We try to use a relay as next step.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +220,6 @@ public class BootstrappedPeerFactory {
|
||||
discoverAfterPortForwarding(peerDHT);
|
||||
}
|
||||
else {
|
||||
log.warn("Port forwarding has failed. Reason: " + futureNAT.failedReason());
|
||||
setState("Port forwarding has failed. We try to use a relay as next step.");
|
||||
bootstrapWithRelay(peerDHT, peerNAT, futureDiscover, futureNAT);
|
||||
}
|
||||
|
@ -41,6 +41,6 @@ public class DefaultMessageModule extends AbstractBitsquareModule implements Mes
|
||||
|
||||
bind(SeedNodeAddress.StaticSeedNodeAddresses.class)
|
||||
.annotatedWith(Names.named("defaultSeedNode"))
|
||||
.toInstance(SeedNodeAddress.StaticSeedNodeAddresses.LOCALHOST);
|
||||
.toInstance(SeedNodeAddress.StaticSeedNodeAddresses.DIGITAL_OCEAN1);
|
||||
}
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ import static org.junit.Assert.*;
|
||||
// TODO Reactivate tests when P2PNode is using original code again. we deactivated the security features atm.
|
||||
// cause IOException: Not listening to anything. Maybe your binding information is wrong.
|
||||
// investigate what has broken it, probably from update to latest head
|
||||
@Ignore
|
||||
public class P2PNodeTest {
|
||||
private static final Logger log = LoggerFactory.getLogger(P2PNodeTest.class);
|
||||
|
||||
final private static Random rnd = new Random(42L);
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testSendData() throws Exception {
|
||||
PeerDHT[] peers = UtilsDHT2.createNodes(3, rnd, new Ports().tcpPort());
|
||||
PeerDHT master = peers[0];
|
||||
@ -98,7 +98,6 @@ public class P2PNodeTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testProtectedPutGet() throws Exception {
|
||||
PeerDHT[] peers = UtilsDHT2.createNodes(3, rnd, new Ports().tcpPort());
|
||||
PeerDHT master = peers[0];
|
||||
@ -185,7 +184,6 @@ public class P2PNodeTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testChangeEntryProtectionKey() throws Exception {
|
||||
KeyPairGenerator gen = KeyPairGenerator.getInstance("DSA");
|
||||
|
||||
@ -220,7 +218,6 @@ public class P2PNodeTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAddToListGetList() throws Exception {
|
||||
|
||||
PeerDHT[] peers = UtilsDHT2.createNodes(3, rnd, new Ports().tcpPort());
|
||||
|
@ -82,7 +82,8 @@ public class UtilsDHT2 {
|
||||
}
|
||||
|
||||
public static PeerAddress createAddress(Number160 idSender, String inetSender, int tcpPortSender,
|
||||
int udpPortSender, boolean firewallUDP, boolean firewallTCP) throws UnknownHostException {
|
||||
int udpPortSender, boolean firewallUDP,
|
||||
boolean firewallTCP) throws UnknownHostException {
|
||||
InetAddress inetSend = InetAddress.getByName(inetSender);
|
||||
PeerSocketAddress peerSocketAddress = new PeerSocketAddress(inetSend, tcpPortSender, udpPortSender);
|
||||
PeerAddress n1 = new PeerAddress(idSender, peerSocketAddress, firewallTCP, firewallUDP, false, false,
|
||||
@ -93,7 +94,8 @@ public class UtilsDHT2 {
|
||||
public static Message createDummyMessage(Number160 idSender, String inetSender, int tcpPortSendor,
|
||||
int udpPortSender, Number160 idRecipien, String inetRecipient,
|
||||
int tcpPortRecipient,
|
||||
int udpPortRecipient, byte command, Type type, boolean firewallUDP, boolean firewallTCP)
|
||||
int udpPortRecipient, byte command, Type type, boolean firewallUDP,
|
||||
boolean firewallTCP)
|
||||
throws UnknownHostException {
|
||||
Message message = new Message();
|
||||
PeerAddress n1 = createAddress(idSender, inetSender, tcpPortSendor, udpPortSender, firewallUDP,
|
||||
@ -121,15 +123,11 @@ public class UtilsDHT2 {
|
||||
* Creates peers for testing. The first peer (peer[0]) will be used as the master. This means that shutting down
|
||||
* peer[0] will shut down all other peers
|
||||
*
|
||||
* @param nrOfPeers
|
||||
* The number of peers to create including the master
|
||||
* @param rnd
|
||||
* The random object to create random peer IDs
|
||||
* @param port
|
||||
* The port where the master peer will listen to
|
||||
* @param nrOfPeers The number of peers to create including the master
|
||||
* @param rnd The random object to create random peer IDs
|
||||
* @param port The port where the master peer will listen to
|
||||
* @return All the peers, with the master peer at position 0 -> peer[0]
|
||||
* @throws Exception
|
||||
* If the creation of nodes fail.
|
||||
* @throws Exception If the creation of nodes fail.
|
||||
*/
|
||||
public static PeerDHT[] createNodes(int nrOfPeers, Random rnd, int port, AutomaticFuture automaticFuture,
|
||||
boolean maintenance) throws Exception {
|
||||
@ -162,7 +160,8 @@ public class UtilsDHT2 {
|
||||
PeerMap peerMap = new PeerMap(new PeerMapConfiguration(peerId));
|
||||
Peer peer = new PeerBuilder(peerId)
|
||||
.masterPeer(master)
|
||||
.enableMaintenance(maintenance).enableMaintenance(maintenance).peerMap(peerMap).bindings(bindings).start().addAutomaticFuture(automaticFuture);
|
||||
.enableMaintenance(maintenance).enableMaintenance(maintenance).peerMap(peerMap).bindings
|
||||
(bindings).start().addAutomaticFuture(automaticFuture);
|
||||
peers[i] = new PeerBuilderDHT(peer).start();
|
||||
}
|
||||
else {
|
||||
@ -210,8 +209,7 @@ public class UtilsDHT2 {
|
||||
* Perfect routing, where each neighbor has contacted each other. This means that for small number of peers, every
|
||||
* peer knows every other peer.
|
||||
*
|
||||
* @param peers
|
||||
* The peers taking part in the p2p network.
|
||||
* @param peers The peers taking part in the p2p network.
|
||||
*/
|
||||
public static void perfectRouting(PeerDHT... peers) {
|
||||
for (int i = 0; i < peers.length; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user