From 6559cfdd5c501b385a80a8c05f7c7feaffb25757 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Tue, 8 Mar 2016 14:13:11 -0500 Subject: [PATCH 1/3] miner stop config threads --- js/mine.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/mine.js b/js/mine.js index c685ae50..7d794415 100644 --- a/js/mine.js +++ b/js/mine.js @@ -39,7 +39,7 @@ miner_obj.start(config.threads); return; } - miner_obj.stop(); + miner_obj.stop(config.threads); fundAccount(config, miner_obj, function () { if (config.mine_periodically) start_periodic_mining(config, miner_obj); @@ -64,7 +64,7 @@ console.log("== Account funded"); blockWatcher.stopWatching(); - miner_obj.stop(); + miner_obj.stop(config.threads); cb(); } }); @@ -106,7 +106,7 @@ next_block_in_ms = (config.interval_ms - ms_since_block); } - miner_obj.stop(); + miner_obj.stop(config.threads); console.log("== Looking for next block in " + next_block_in_ms + "ms"); setTimeout(function () { @@ -130,7 +130,7 @@ web3.eth.filter("latest").watch(function () { if (!pendingTransactions()) { console.log("== No transactions left. Stopping miner..."); - miner_obj.stop(); + miner_obj.stop(config.threads); } }); }; From 7afed75e5801fddb0bcd9dbfb944f46b7803da0f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 8 Mar 2016 14:44:40 -0500 Subject: [PATCH 2/3] update tests --- test/blockchain.js | 2 +- test/deploy.js | 2 +- test/support/chain_manager.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/blockchain.js b/test/blockchain.js index dde6523f..1e1cd787 100644 --- a/test/blockchain.js +++ b/test/blockchain.js @@ -10,7 +10,7 @@ describe('embark.blockchain', function() { var blockchain = new Blockchain(blockchainConfig); it('should return correct cmd', function() { - assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --rpcaddr localhost --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --genesis=\"config/genesis.json\" --rpcapi \"eth,web3\" --maxpeers 4 --password config/password "); + assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --rpcaddr localhost --networkid "+blockchainConfig.networkId+" --rpccorsdomain * --minerthreads \"1\" --genesis=\"config/genesis.json\" --rpcapi \"eth,web3\" --maxpeers 4 --password config/password "); }); }); diff --git a/test/deploy.js b/test/deploy.js index f547bb31..fbe92f82 100644 --- a/test/deploy.js +++ b/test/deploy.js @@ -77,7 +77,7 @@ describe('embark.deploy', function() { result += deploy.generate_provider_file(); result += deploy.generate_abi_file(); - assert.strictEqual(result, "web3.setProvider(new web3.providers.HttpProvider('http://localhost:8101'));web3.eth.defaultAccount = web3.eth.accounts[0];SimpleStorageAbi = 123;SimpleStorageContract = web3.eth.contract(SimpleStorageAbi);SimpleStorage = SimpleStorageContract.at('0x123');AnotherStorageAbi = 234;AnotherStorageContract = web3.eth.contract(AnotherStorageAbi);AnotherStorage = AnotherStorageContract.at('0x234');"); + assert.strictEqual(result, "web3.setProvider(new web3.providers.HttpProvider('http://localhost:8101'));web3.eth.defaultAccount = web3.eth.accounts[0];blockchain = {\"rpcHost\":\"localhost\",\"rpcPort\":8101,\"gasLimit\":1000000,\"gasPrice\":10000000000000,\"rpcWhitelist\":\"*\",\"nat\":[],\"minerthreads\":1,\"genesisBlock\":\"config/genesis.json\",\"datadir\":\"/tmp/embark\",\"bootNodes\":[],\"deployTimeout\":20,\"networkId\":"+deploy.blockchainConfig.networkId+",\"maxPeers\":4,\"mine\":false,\"port\":\"30303\",\"console_toggle\":false,\"mine_when_needed\":true,\"whisper\":false,\"account\":{\"init\":true,\"password\":\"config/password\"},\"geth_extra_opts\":[],\"testnet\":false,\"deploy_synchronously\":false};SimpleStorageAbi = 123;SimpleStorageContract = web3.eth.contract(SimpleStorageAbi);SimpleStorage = SimpleStorageContract.at('0x123');AnotherStorageAbi = 234;AnotherStorageContract = web3.eth.contract(AnotherStorageAbi);AnotherStorage = AnotherStorageContract.at('0x234');contractDB = {\"SimpleStorage\":{\"compiled\":{\"info\":{\"abiDefinition\":123}}},\"AnotherStorage\":{\"compiled\":{\"info\":{\"abiDefinition\":234}}}};"); }); }); }); diff --git a/test/support/chain_manager.json b/test/support/chain_manager.json index 2108f66b..eb61198a 100644 --- a/test/support/chain_manager.json +++ b/test/support/chain_manager.json @@ -1 +1 @@ -{"0x021a83120c235da14ec41c513dabf7e56e5d8a820177df9da3d1fd2b9c2daf91":{"contracts":{"d5d91a8825c5c253dff531ddda2354c4014f5699b7bcbea70207cfdcb37b6c8b":{"name":"Foo","address":"0x123"}}}} \ No newline at end of file +{"0xc16b5bca90004b19e2d8d49b2fcaaa8a42c58ec46fe293a6962e6eeee084872c":{"contracts":{"d5d91a8825c5c253dff531ddda2354c4014f5699b7bcbea70207cfdcb37b6c8b":{"name":"Foo","address":"0x123"}}}} \ No newline at end of file From 5216d20062825f6f42a5bf44241304ec92b033b9 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 8 Mar 2016 14:57:29 -0500 Subject: [PATCH 3/3] update tests --- test/chain_manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/chain_manager.js b/test/chain_manager.js index 790df54d..fd1a0470 100644 --- a/test/chain_manager.js +++ b/test/chain_manager.js @@ -20,7 +20,7 @@ describe('embark.chain_manager', function() { chainManager.init('development', blockchainConfig, web3); it('should initialize chain', function() { - var chain = chainManager.chainManagerConfig['0x021a83120c235da14ec41c513dabf7e56e5d8a820177df9da3d1fd2b9c2daf91'] + var chain = chainManager.chainManagerConfig['0xc16b5bca90004b19e2d8d49b2fcaaa8a42c58ec46fe293a6962e6eeee084872c'] assert.equal(chain != undefined, true); }); }); @@ -31,7 +31,7 @@ describe('embark.chain_manager', function() { chainManager.addContract("Foo", "123456", [], "0x123"); console.log(chainManager.chainManagerConfig); - var chain = chainManager.chainManagerConfig['0x021a83120c235da14ec41c513dabf7e56e5d8a820177df9da3d1fd2b9c2daf91'] + var chain = chainManager.chainManagerConfig['0xc16b5bca90004b19e2d8d49b2fcaaa8a42c58ec46fe293a6962e6eeee084872c'] var contract = chain.contracts["d5d91a8825c5c253dff531ddda2354c4014f5699b7bcbea70207cfdcb37b6c8b"] assert.equal(contract.name, "Foo"); @@ -58,7 +58,7 @@ describe('embark.chain_manager', function() { var chainFile = './test/support/chain_manager.json'; var content = fs.readFileSync(chainFile).toString(); - assert.equal(content, '{"0x021a83120c235da14ec41c513dabf7e56e5d8a820177df9da3d1fd2b9c2daf91":{"contracts":{"d5d91a8825c5c253dff531ddda2354c4014f5699b7bcbea70207cfdcb37b6c8b\":{"name":"Foo","address":"0x123"}}}}'); + assert.equal(content, '{"0xc16b5bca90004b19e2d8d49b2fcaaa8a42c58ec46fe293a6962e6eeee084872c":{"contracts":{"d5d91a8825c5c253dff531ddda2354c4014f5699b7bcbea70207cfdcb37b6c8b\":{"name":"Foo","address":"0x123"}}}}'); }); });