diff --git a/blockchainManager.js b/blockchainManager.js index 450ae7d..7a47234 100644 --- a/blockchainManager.js +++ b/blockchainManager.js @@ -641,18 +641,17 @@ class BlockchainManager { /** Get the state of the database */ return mongo.getAllAst() .then((result) => { - let arr = result; + modState = result; for (let i = 0; i < schedule.length; i++) { - for (let x = 0; x < arr.length; x++) { - if (arr[x].id == schedule[i].from) { - arr[x].balance = arr[x].balance - schedule[i].funds; + for (let x = 0; x < modState.length; x++) { + if (modState[x].id == schedule[i].from) { + modState[x].balance = modState[x].balance - schedule[i].funds; } - if (arr[x].id == schedule[i].to) { - arr[x].balance = arr[x].balance + schedule[i].funds; + if (modState[x].id == schedule[i].to) { + modState[x].balance = modState[x].balance + schedule[i].funds; } } } - modState = arr; return bm.init(); }) .then(() => { @@ -660,13 +659,22 @@ class BlockchainManager { }) .then((rawLedger) => { let state = true; + let unsynced = []; for (let i = 0; i < rawLedger.length; i++) { for (let x = 0; x < modState.length; x++) { if (rawLedger[i].id == modState[x].id && rawLedger[i].balance != modState[x].balance) { + unsynced.push(rawLedger[i].id); state = false; } } } + if(!state){ + console.log('=============== UNSYNCED ==============='); + for(let i=0;i"}$ +2017-11-01T18:40:17.021Z ERROR HLFConnection :ping() {"message":"Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))","stack":"Error: Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))\n at _checkRuntimeVersions.then.catch (/Users/a01334390/Documents/Git Projects/Lyra/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:663:34)\n at "}$ diff --git a/dist/lyra-cli.bna b/dist/lyra-cli.bna index 312469a..9d14c90 100644 Binary files a/dist/lyra-cli.bna and b/dist/lyra-cli.bna differ diff --git a/index.js b/index.js index f307f43..7bc841b 100755 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ var figlet = require('figlet'); var inquirer = require('inquirer'); //Hyperledger Fabric Code And Connectors -var hyper = require('./lib/blockchainManager'); +var hyper = require('./blockchainManager'); var jsond = require('./package'); var index = require('.');