mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-03 04:06:23 -04:00
Some comments on peer creation in network stress test
This commit is contained in:
parent
acb31003ed
commit
9e61f1f3db
1 changed files with 8 additions and 1 deletions
|
@ -129,7 +129,7 @@ public class NetworkStressTest {
|
||||||
new SeedServiceListener(localServicesLatch, localServicesFailed));
|
new SeedServiceListener(localServicesLatch, localServicesFailed));
|
||||||
print("created seed node");
|
print("created seed node");
|
||||||
|
|
||||||
// Create and start peer nodes.
|
// Create and start peer nodes, all connecting to the seed node above.
|
||||||
SeedNodesRepository seedNodesRepository = new SeedNodesRepository();
|
SeedNodesRepository seedNodesRepository = new SeedNodesRepository();
|
||||||
if (useLocalhost) {
|
if (useLocalhost) {
|
||||||
seedNodesRepository.setLocalhostSeedNodeAddresses(seedNodes);
|
seedNodesRepository.setLocalhostSeedNodeAddresses(seedNodes);
|
||||||
|
@ -137,17 +137,24 @@ public class NetworkStressTest {
|
||||||
seedNodesRepository.setTorSeedNodeAddresses(seedNodes);
|
seedNodesRepository.setTorSeedNodeAddresses(seedNodes);
|
||||||
}
|
}
|
||||||
for (int p = 0; p < nPeers; p++) {
|
for (int p = 0; p < nPeers; p++) {
|
||||||
|
// peer network port
|
||||||
final int peerPort = Utils.findFreeSystemPort();
|
final int peerPort = Utils.findFreeSystemPort();
|
||||||
|
|
||||||
|
// peer data directories
|
||||||
final File peerDir = new File(testDataDir.toFile(), String.format("peer-%06d", p));
|
final File peerDir = new File(testDataDir.toFile(), String.format("peer-%06d", p));
|
||||||
final File peerTorDir = new File(peerDir, "tor");
|
final File peerTorDir = new File(peerDir, "tor");
|
||||||
final File peerStorageDir = new File(peerDir, "db");
|
final File peerStorageDir = new File(peerDir, "db");
|
||||||
final File peerKeysDir = new File(peerDir, "keys");
|
final File peerKeysDir = new File(peerDir, "keys");
|
||||||
//noinspection ResultOfMethodCallIgnored
|
//noinspection ResultOfMethodCallIgnored
|
||||||
peerKeysDir.mkdirs(); // needed for creating the key ring
|
peerKeysDir.mkdirs(); // needed for creating the key ring
|
||||||
|
|
||||||
|
// peer keys
|
||||||
final KeyStorage peerKeyStorage = new KeyStorage(peerKeysDir);
|
final KeyStorage peerKeyStorage = new KeyStorage(peerKeysDir);
|
||||||
final KeyRing peerKeyRing = new KeyRing(peerKeyStorage);
|
final KeyRing peerKeyRing = new KeyRing(peerKeyStorage);
|
||||||
peerPKRings.add(peerKeyRing.getPubKeyRing());
|
peerPKRings.add(peerKeyRing.getPubKeyRing());
|
||||||
final EncryptionService peerEncryptionService = new EncryptionService(peerKeyRing);
|
final EncryptionService peerEncryptionService = new EncryptionService(peerKeyRing);
|
||||||
|
|
||||||
|
// create, save and start peer
|
||||||
final P2PService peer = new P2PService(seedNodesRepository, peerPort, peerTorDir, useLocalhost,
|
final P2PService peer = new P2PService(seedNodesRepository, peerPort, peerTorDir, useLocalhost,
|
||||||
REGTEST_NETWORK_ID, peerStorageDir, new Clock(), peerEncryptionService, peerKeyRing);
|
REGTEST_NETWORK_ID, peerStorageDir, new Clock(), peerEncryptionService, peerKeyRing);
|
||||||
peerNodes.add(peer);
|
peerNodes.add(peer);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue