Last active
July 23, 2018 01:24
-
-
Save tinybike/a84edf0191bd2bc01374bb2af0a5dc45 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // ETHEREUM_HTTP=http://gethstar.com ETHEREUM_WS=ws://gethstar.com/ws node build/syncSpammer.js | |
| import { existsSync, mkdirSync } from "fs"; | |
| import { whilst } from "async"; | |
| import Augur from "augur.js"; | |
| import { NetworkConfiguration } from "augur-core"; | |
| import { AugurNodeController } from "./controller"; | |
| const networkName = process.argv[2] || "environment"; | |
| const networkConfig = NetworkConfiguration.create(networkName); | |
| let count = 0; | |
| whilst( | |
| () => ++count < 100, | |
| (callback: any) => { | |
| const augur: Augur = new Augur(); | |
| console.log("Creating controller", count); | |
| const dbPath = "./spamdb-" + count.toString(); | |
| if (!existsSync(dbPath)) mkdirSync(dbPath); | |
| const augurNodeController = new AugurNodeController(augur, networkConfig, dbPath); | |
| augur.rpc.setDebugOptions({ broadcast: false }); | |
| augur.events.nodes.ethereum.on("disconnect", (event) => { | |
| console.log("Disconnected from Ethereum node", event); | |
| augurNodeController.shutdown(); | |
| throw new Error("Disconnected from Ethereum node"); | |
| }); | |
| const errorCallback = (err: any) => { | |
| throw new Error("Fatal Error:" + JSON.stringify(err)); | |
| process.exit(1); | |
| }; | |
| augurNodeController.start(errorCallback).catch(errorCallback); | |
| setTimeout(() => callback(), 1000); | |
| }, | |
| (err: any) => console.error(err), | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment