Kernal issue

This commit is contained in:
SuriyaR 2019-08-09 12:00:06 +05:30
parent 3ddeb8722b
commit dd20417adb

View File

@ -28,6 +28,15 @@ export class BlockchainKernelController {
this.IntializeRoutes(); this.IntializeRoutes();
} }
IsJsonString(str) {
try {
var dataJson = JSON.parse(str);
} catch (e) {
return [];
}
return dataJson;
}
public IntializeRoutes() { public IntializeRoutes() {
/** /**
* @swagger * @swagger
@ -505,6 +514,7 @@ export class BlockchainKernelController {
response: Response, response: Response,
next: NextFunction, next: NextFunction,
) => { ) => {
var self = this;
try { try {
http.get('http://116.203.152.58:3413/v1/peers/connected', (resp) => { http.get('http://116.203.152.58:3413/v1/peers/connected', (resp) => {
// console.log('resp resp respresp',resp); // console.log('resp resp respresp',resp);
@ -513,7 +523,8 @@ export class BlockchainKernelController {
// A chunk of data has been recieved. // A chunk of data has been recieved.
resp.on('data', function (chunk) { resp.on('data', function (chunk) {
data += chunk; data += chunk;
let dataJson = JSON.parse(data);
let dataJson = self.IsJsonString(data);
dataJson.forEach(function (value, i) { dataJson.forEach(function (value, i) {
value['id'] = i; value['id'] = i;
}); });
@ -533,6 +544,7 @@ export class BlockchainKernelController {
} }
}; };
private TransactionFee = async ( private TransactionFee = async (
request: Request, request: Request,
response: Response, response: Response,