Skip to content

Commit

Permalink
Merge pull request #106 from Izzzio/change-default
Browse files Browse the repository at this point in the history
Change default params
  • Loading branch information
nedobylskiy authored Feb 19, 2020
2 parents fb3933d + 3268129 commit 6f7314d
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 57 deletions.
6 changes: 6 additions & 0 deletions .tabnineignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
runtime
blocks
EcmaContracts
contractsRuntime
BigNet/test
Tests/*
8 changes: 7 additions & 1 deletion BigNet/test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"initialPeers": [
],
"recieverAddress": "nodeOne",
"validators": [
"lcpoa",
"thrusted"
],
"blockHashFilter": {
"blockEndls": [
"f3c3",
Expand Down Expand Up @@ -32,5 +36,7 @@
"masterContract": 5
},
"signFunction": "NEWRSA",
"plugins": [ "iz3-basic-crypto" ]
"plugins": [
"iz3-basic-crypto"
]
}
37 changes: 0 additions & 37 deletions Blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,6 @@ function Blockchain(config) {
config.validators[0].generateNextBlock(blockData, function (generatedBlock) {
addBlock(generatedBlock);
broadcastLastBlock();
setTimeout(coinEmission, 2000);
cb(generatedBlock);
});
}, function () {
Expand All @@ -1708,41 +1707,6 @@ function Blockchain(config) {
}
}

/**
* Первичный выпуск монет
* Заложенно config.initialEmission * precision
* где precision это максимальная точность при операциях с не дробными монетами
*/
function coinEmission() {
if(config.disableInternalToken) {
return;
}
if(!blockHandler.isKeyFromKeyring(wallet.keysPair.public)) {
logger.error("The selected key does not belong to the keychain! Emission corrupted.");
return;
}

logger.info('Starting coin emission ' + (config.initialEmission));

wallet.transanctions = [];
wallet.transact(wallet.id, config.initialEmission * config.precision, null, true);
let blockData = wallet.transanctions.pop();

transactor.transact(blockData, function (blockData, cb) {
config.validators[0].generateNextBlock(blockData, function (generatedBlock) {
addBlock(generatedBlock);
broadcastLastBlock();
setTimeout(function () {
config.validators[0].generateEmptyBlock(true);
}, 1000);
cb(generatedBlock);

});
}, function () {
console.log('Emission: Emission accepted');
blockHandler.resync();
});
}


/**
Expand Down Expand Up @@ -1923,7 +1887,6 @@ function Blockchain(config) {
broadcastMessage: broadcastMessage,
createWalletIfNotExsists: createWalletIfNotExsists,
keyringEmission: keyringEmission,
coinEmission: coinEmission,
genesisTiemstamp: genesisTiemstamp,
wallet: wallet,
app: app,
Expand Down
4 changes: 4 additions & 0 deletions Tests/CustomDB/test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"httpPort": 3015,
"initialPeers": [
],
"validators": [
"lcpoa",
"thrusted"
],
"recieverAddress": "nodeOne",
"blockHashFilter": {
"blockEndls": [
Expand Down
4 changes: 4 additions & 0 deletions Tests/HardSyncTest/test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"httpPort": 3015,
"initialPeers": [
],
"validators": [
"lcpoa",
"thrusted"
],
"recieverAddress": "nodeOne",
"blockHashFilter": {
"blockEndls": [
Expand Down
4 changes: 4 additions & 0 deletions Tests/HardSyncTest/test/config2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"httpPort": 3016,
"initialPeers": [
],
"validators": [
"lcpoa",
"thrusted"
],
"recieverAddress": "nodeTwo",
"blockHashFilter": {
"blockEndls": [
Expand Down
4 changes: 4 additions & 0 deletions Tests/Network/test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"httpPort": 3015,
"initialPeers": [
],
"validators": [
"lcpoa",
"thrusted"
],
"recieverAddress": "nodeOne",
"blockHashFilter": {
"blockEndls": [
Expand Down
4 changes: 4 additions & 0 deletions Tests/Network/test/config2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"httpPort": 3016,
"initialPeers": [
],
"validators": [
"lcpoa",
"thrusted"
],
"recieverAddress": "nodeTwo",
"blockHashFilter": {
"blockEndls": [
Expand Down
4 changes: 4 additions & 0 deletions Tests/PluginsTest/test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"httpPort": 3015,
"initialPeers": [
],
"validators": [
"lcpoa",
"thrusted"
],
"recieverAddress": "nodeOne",
"blockHashFilter": {
"blockEndls": [
Expand Down
4 changes: 4 additions & 0 deletions Tests/WaterfallSpeedTest/test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"httpPort": 3017,
"initialPeers": [
],
"validators": [
"lcpoa",
"thrusted"
],
"recieverAddress": "nodeOne",
"blockHashFilter": {
"blockEndls": [
Expand Down
36 changes: 18 additions & 18 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ program
.option('--clear', 'Clear all saved chain and deletes wallet. WARNING: You can lose important data')
.option('--clear-db', 'Clear all saved chain and calculated wallets.')
.option('-c, --config [path]', 'Core config path', 'config.json')
.option('--write-config [path]', 'Save config in [path] file', false)
.option('--work-dir [path]', 'Working directory', false)
.option('--keyring-emission', 'Generate and deploy keyring', false)
.option('--generate-wallets [keyring path]', 'Generate wallets from keyring file', false)
.option('--new-chain', 'Generates keyring and token emission if possible', false)
.option('--fall-on-errors', 'Allow stop node on uncaught exceptions', false)
.option('--new-chain', 'Starts new chain', false)
.option('--fall-on-errors', 'Stops node with error code on uncaught exceptions', false)
.option('--block-accept-count [count]', 'Number of blocks to confirm transaction')
.option('--http-port [port]', 'Interface and RPC binding port')
.option('--disable-rpc-password', 'Disable RPC password', false)
.option('--disable-mining', 'Completely disables mining', false)
.option('--fast-load', 'Don\'t checking databased on startup', false)
.option('--fast-load', 'Don\'t checking saved blocks database on startup', false)
.option('--verbose', 'More logging info', false)
.option('--enable-address-rotation', 'Activates the rotation of the addresses', false)
.option('--no-splash', 'Disable splash screen', false)
Expand Down Expand Up @@ -88,19 +89,15 @@ const config = {
newNetwork: false, //Если будет обнаружен запуск новой сети блокчейн, будет произведена автоматическая эмиссия ключей и денег
lcpoaVariantTime: 1, //Количество милилсекунд, требуемое на генерацию одного хеша блока
validators: [ //"Валидаторы" - дополнительные проверяющие блоков, для введения дополнительных консенсусов, кроме LCPoA
'lcpoa', //БЕЗ КОНСЕНСУСА БЕЗ КЛЮЧЕЙ АВТОМАТИЧЕСКАЯ ЭМИССИЯ НЕВОЗМОЖНА
'thrusted'
'dlcpoa',
//'lcpoa', //БЕЗ КОНСЕНСУСА БЕЗ КЛЮЧЕЙ АВТОМАТИЧЕСКАЯ ЭМИССИЯ НЕВОЗМОЖНА
//'thrusted'
],
emptyBlockInterval: 10000, //Интервал проверки необходимости выпуска пустого блока
blacklisting: false,
maxTransactionAtempts: 5, //Сколько попыток добавить блок мы предпренимаем
keyringKeysCount: 5, //Сколько генерировать ключей в связку при старте сети. Используется в Trusted консенсусе и других
checkExternalConnectionData: false, //Проверять внешние данные на соответствие
disableInternalToken: false, //выключить выпуск старых денег(false - разрешено выпускать старые деньги, true - запрет на выпуск)

//Tokens
precision: 10000000000, //Точность вычислений для кошелька
initialEmission: 100000000, //Сумма первоначальной эмиссии (нужна только при эмиссии)

//Messaging Bus
enableMessaging: false, //Разрешить использование шины сообщений (необходима для некоторых консенсусов)
Expand Down Expand Up @@ -137,7 +134,7 @@ const config = {

//Cryptography
hashFunction: 'SHA256', //функция вычисления хэша
signFunction: '', //Функция вычисления цифровой подписи и генерации паролей(пустая-значит, по умолчанию используется), 'GOST' 'GOST256' 'NEWRSA'
signFunction: 'NEWRSA', //Функция вычисления цифровой подписи и генерации паролей(пустая-значит, по умолчанию используется), 'GOST' 'GOST256' 'NEWRSA'
keyLength: 2048, //Key length for some algorithms
generatorFunction: 'NEWRSA', //Key generator function

Expand Down Expand Up @@ -174,14 +171,17 @@ try {
}
}


/* try {
fs.writeFileSync('config.json', JSON.stringify(config));
} catch (e) {
console.log('Info: Can\'t save config');
}*/
} catch (e) {
logger.info('No configure found. Using standard configuration.');
logger.warning('No configure found. Using standard configuration.');
}


if(program.writeConfig) {
try {
fs.writeFileSync(program.writeConfig, JSON.stringify(config));
} catch (e) {
logger.warning('Can\'t save config');
}
}

config.program = program;
Expand Down
2 changes: 1 addition & 1 deletion modules/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ let Wallet = function (walletFile, config) {


wallet.update = function () {
wallet.log('Info: Wallet balance: ' + formatToken(wallet.balance, config.precision));
//wallet.log('Info: Wallet balance: ' + formatToken(wallet.balance, config.precision));
wallet.save();
};

Expand Down

0 comments on commit 6f7314d

Please sign in to comment.