This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starts on tests for larger peer groups
- Loading branch information
1 parent
f4e2e25
commit 3150eb5
Showing
2 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Connect to three peers (four total clients) | ||
// The peers will have no peers themselves | ||
// Send a message with a signature request containing all four peers | ||
// Check to see if the three peers now have all the peers themselves | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const Bridge = require('../src/lib/Bridge.js'); | ||
const Log = require('../src/log.js'); | ||
const Web3 = require('web3'); | ||
const config = require('../data/config.json'); | ||
const Peers = require('../src/peers.js'); | ||
|
||
const index = Object.keys(config)[0]; | ||
const web3A = new Web3(new Web3.providers.HttpProvider('http://localhost:7545')); | ||
const web3B = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); | ||
const hosts = [web3A, web3B] | ||
|
||
Log.setLogger(`${process.cwd()}`); | ||
|
||
const b2 = new Bridge({ | ||
port: 10000, | ||
clients: hosts, | ||
index: index, | ||
peers: [] | ||
}) | ||
|
||
const peerHosts = [ 'localhost:10000' ] | ||
Peers.connectToPeers(peerHosts, (err, peers) => { | ||
const b1 = new Bridge({ | ||
port: 9999, | ||
clients: hosts, | ||
index: index, | ||
peers: peers | ||
}) | ||
}) | ||
|
||
fs.unlinkSync(`${process.cwd()}/log`) |