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