Merge pull request #43 from jorisbontje/41-genesis-block-not-found
make genesis block configurable
This commit is contained in:
commit
29d25e3621
|
@ -1,2 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
TODO
|
TODO
|
||||||
|
.node-xmlhttprequest-sync-*
|
||||||
|
|
|
@ -3,6 +3,7 @@ development:
|
||||||
rpc_port: 8101
|
rpc_port: 8101
|
||||||
rpc_whitelist: "*"
|
rpc_whitelist: "*"
|
||||||
minerthreads: 1
|
minerthreads: 1
|
||||||
|
genesis_block: config/genesis.json
|
||||||
datadir: /tmp/embark
|
datadir: /tmp/embark
|
||||||
mine_when_needed: true
|
mine_when_needed: true
|
||||||
gas_limit: 500000
|
gas_limit: 500000
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"difficulty": "0x40000",
|
||||||
|
"alloc": {
|
||||||
|
},
|
||||||
|
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x",
|
||||||
|
"gasLimit": "0x4c4b40"
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ development:
|
||||||
rpc_port: 8101
|
rpc_port: 8101
|
||||||
rpc_whitelist: "*"
|
rpc_whitelist: "*"
|
||||||
minerthreads: 1
|
minerthreads: 1
|
||||||
|
genesis_block: config/genesis.json
|
||||||
datadir: /tmp/embark
|
datadir: /tmp/embark
|
||||||
mine_when_needed: true
|
mine_when_needed: true
|
||||||
gas_limit: 500000
|
gas_limit: 500000
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"difficulty": "0x40000",
|
||||||
|
"alloc": {
|
||||||
|
},
|
||||||
|
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x",
|
||||||
|
"gasLimit": "0x4c4b40"
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ development:
|
||||||
rpc_port: 8101
|
rpc_port: 8101
|
||||||
rpc_whitelist: "*"
|
rpc_whitelist: "*"
|
||||||
minerthreads: 1
|
minerthreads: 1
|
||||||
|
genesis_block: config/genesis.json
|
||||||
datadir: /tmp/embark
|
datadir: /tmp/embark
|
||||||
mine_when_needed: true
|
mine_when_needed: true
|
||||||
gas_limit: 500000
|
gas_limit: 500000
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"difficulty": "0x40000",
|
||||||
|
"alloc": {
|
||||||
|
},
|
||||||
|
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x",
|
||||||
|
"gasLimit": "0x4c4b40"
|
||||||
|
}
|
|
@ -26,6 +26,9 @@ Blockchain.prototype.generate_basic_command = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd += "--mine ";
|
cmd += "--mine ";
|
||||||
|
if (config.genesisBlock !== void 0) {
|
||||||
|
cmd += "--genesis=\"" + config.genesisBlock + "\" ";
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: this should be configurable
|
//TODO: this should be configurable
|
||||||
cmd += "--maxpeers 0 ";
|
cmd += "--maxpeers 0 ";
|
||||||
|
|
|
@ -38,6 +38,7 @@ BlockchainConfig.prototype.config = function(env) {
|
||||||
gasPrice: config.gas_price || 10000000000000,
|
gasPrice: config.gas_price || 10000000000000,
|
||||||
rpcWhitelist: config.rpc_whitelist,
|
rpcWhitelist: config.rpc_whitelist,
|
||||||
minerthreads: config.minerthreads,
|
minerthreads: config.minerthreads,
|
||||||
|
genesisBlock: config.genesis_block,
|
||||||
datadir: config.datadir,
|
datadir: config.datadir,
|
||||||
networkId: networkId,
|
networkId: networkId,
|
||||||
port: config.port || "30303",
|
port: config.port || "30303",
|
||||||
|
@ -50,4 +51,3 @@ BlockchainConfig.prototype.config = function(env) {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = BlockchainConfig;
|
module.exports = BlockchainConfig;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe('embark.blockchain', function() {
|
||||||
var blockchain = new Blockchain(blockchainConfig);
|
var blockchain = new Blockchain(blockchainConfig);
|
||||||
|
|
||||||
it('should return correct cmd', function() {
|
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 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --maxpeers 0 --password config/password ");
|
assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --maxpeers 0 --password config/password ");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ describe('embark.config.blockchain', function() {
|
||||||
rpc_whitelist: "*",
|
rpc_whitelist: "*",
|
||||||
network_id: 0,
|
network_id: 0,
|
||||||
minerthreads: 1,
|
minerthreads: 1,
|
||||||
|
genesis_block: 'config/genesis.json',
|
||||||
datadir: '/tmp/embark',
|
datadir: '/tmp/embark',
|
||||||
mine_when_needed: true,
|
mine_when_needed: true,
|
||||||
gas_limit: 123,
|
gas_limit: 123,
|
||||||
|
@ -63,6 +64,7 @@ describe('embark.config.blockchain', function() {
|
||||||
gasPrice: 100,
|
gasPrice: 100,
|
||||||
rpcWhitelist: "*",
|
rpcWhitelist: "*",
|
||||||
minerthreads: 1,
|
minerthreads: 1,
|
||||||
|
genesisBlock: 'config/genesis.json',
|
||||||
datadir: '/tmp/embark',
|
datadir: '/tmp/embark',
|
||||||
networkId: 0,
|
networkId: 0,
|
||||||
port: "30303",
|
port: "30303",
|
||||||
|
@ -103,6 +105,7 @@ describe('embark.config.blockchain', function() {
|
||||||
gasPrice: 10000000000000,
|
gasPrice: 10000000000000,
|
||||||
rpcWhitelist: "*",
|
rpcWhitelist: "*",
|
||||||
minerthreads: 1,
|
minerthreads: 1,
|
||||||
|
genesisBlock: undefined,
|
||||||
datadir: '/tmp/embark',
|
datadir: '/tmp/embark',
|
||||||
networkId: 0,
|
networkId: 0,
|
||||||
port: "30303",
|
port: "30303",
|
||||||
|
@ -122,4 +125,3 @@ describe('embark.config.blockchain', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ development:
|
||||||
rpc_port: 8101
|
rpc_port: 8101
|
||||||
rpc_whitelist: "*"
|
rpc_whitelist: "*"
|
||||||
minerthreads: 1
|
minerthreads: 1
|
||||||
|
genesis_block: config/genesis.json
|
||||||
datadir: /tmp/embark
|
datadir: /tmp/embark
|
||||||
mine_when_needed: true
|
mine_when_needed: true
|
||||||
gas_limit: 500000
|
gas_limit: 500000
|
||||||
|
|
Loading…
Reference in New Issue