mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-11-09 13:10:44 +00:00
Increased num_max_events for forwarding history
Increased num_max_events for forwarding history
This commit is contained in:
parent
c57fe3e1a3
commit
f27d92456a
@ -9,5 +9,5 @@
|
||||
<link rel="stylesheet" href="styles.e17b3e633fdc1b95cf2d.css"></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script src="runtime.88f7d5ca01d0ac3bdb2f.js" defer></script><script src="polyfills-es5.1044268585cf44801d80.js" nomodule defer></script><script src="polyfills.161d4b199a78130ce90f.js" defer></script><script src="main.4fb76a2e5ad1597c6903.js" defer></script></body>
|
||||
<script src="runtime.ca7efa856b7b1b8b524a.js" defer></script><script src="polyfills-es5.acd0700da9b9f555b1f8.js" nomodule defer></script><script src="polyfills.69620c10d7f64d0a6eb1.js" defer></script><script src="main.6f1262bc902746fe0d4e.js" defer></script></body>
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
1
angular/main.6f1262bc902746fe0d4e.js
Normal file
1
angular/main.6f1262bc902746fe0d4e.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],p=0,s=[];p<i.length;p++)a=i[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"1876d77a92cda619867d",6:"2317bfe02556b0f35de2",7:"eedde53140a64ad8b285"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([]);
|
||||
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],p=0,s=[];p<i.length;p++)a=i[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"1876d77a92cda619867d",6:"a12d6f3261985c3ac37c",7:"9c570f209edddb0ec8d3"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([]);
|
@ -1,6 +1,7 @@
|
||||
var request = require('request-promise');
|
||||
var common = require('../../common');
|
||||
var logger = require('../logger');
|
||||
var swtch = require('./switch');
|
||||
var options = {};
|
||||
|
||||
exports.getFees = (req, res, next) => {
|
||||
@ -32,7 +33,27 @@ exports.getFees = (req, res, next) => {
|
||||
} else {
|
||||
body.btc_month_fee_sum = common.convertToBTC(body.month_fee_sum);
|
||||
}
|
||||
res.status(200).json(body);
|
||||
let current_time = Math.round((new Date().getTime()) / 1000);
|
||||
let month_start_time = current_time - 2629743;
|
||||
let week_start_time = current_time - 604800;
|
||||
let day_start_time = current_time - 86400;
|
||||
return swtch.getAllForwardingEvents(month_start_time, current_time, 0, 1000)
|
||||
.then((history) => {
|
||||
logger.info({fileName: 'Fees', msg: 'Forwarding History Received: ' + JSON.stringify(history)});
|
||||
let daily_tx_count = history.forwarding_events.filter(event => event.timestamp >= day_start_time);
|
||||
body.daily_tx_count = daily_tx_count && daily_tx_count.length ? daily_tx_count.length : 0;
|
||||
let weekly_tx_count = history.forwarding_events.filter(event => event.timestamp >= week_start_time);
|
||||
body.weekly_tx_count = weekly_tx_count && weekly_tx_count.length ? weekly_tx_count.length : 0;
|
||||
body.monthly_tx_count = history.forwarding_events && history.forwarding_events.length ? history.forwarding_events.length : 0;
|
||||
return res.status(200).json(body);
|
||||
})
|
||||
.catch(err => {
|
||||
logger.error({fileName: 'Fees', lineNum: 54, msg: 'Fetch Fee Error: ' + JSON.stringify(err)});
|
||||
return res.status(500).json({
|
||||
message: "Fetching fee failed!",
|
||||
error: err.error
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
|
@ -3,46 +3,53 @@ var common = require('../../common');
|
||||
var logger = require('../logger');
|
||||
var options = {};
|
||||
|
||||
exports.forwardingHistory = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/switch';
|
||||
options.form = {};
|
||||
if (undefined !== req.body.num_max_events) {
|
||||
options.form.num_max_events = req.body.num_max_events;
|
||||
}
|
||||
if (undefined !== req.body.index_offset) {
|
||||
options.form.index_offset = req.body.index_offset;
|
||||
}
|
||||
if (undefined !== req.body.end_time) {
|
||||
options.form.end_time = req.body.end_time;
|
||||
}
|
||||
if (undefined !== req.body.start_time) {
|
||||
options.form.start_time = req.body.start_time;
|
||||
}
|
||||
options.form = JSON.stringify(options.form);
|
||||
logger.info({fileName: 'Switch', msg: 'Switch Post Options: ' + JSON.stringify(options)});
|
||||
request.post(options).then((body) => {
|
||||
logger.info({fileName: 'Switch', msg: 'Switch Post Response: ' + JSON.stringify(body)});
|
||||
if(undefined === body || body.error) {
|
||||
logger.error({fileName: 'Switch', lineNum: 27, msg: 'Switch Post Erroe: ' + JSON.stringify((undefined === body) ? 'Error From Server!' : body.error)});
|
||||
res.status(500).json({
|
||||
message: "Switch post failed!",
|
||||
error: (undefined === body) ? 'Error From Server!' : body.error
|
||||
});
|
||||
} else {
|
||||
if (undefined !== body.forwarding_events && body.forwarding_events.length > 0) {
|
||||
body.forwarding_events.forEach(event => {
|
||||
event.timestamp_str = (undefined === event.timestamp) ? '' : common.convertTimestampToDate(event.timestamp);
|
||||
});
|
||||
body.forwarding_events = common.sortDescByKey(body.forwarding_events, 'timestamp');
|
||||
}
|
||||
exports.getAllForwardingEvents = (start, end, offset, max_events) => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/switch';
|
||||
options.form = {};
|
||||
if (start) { options.form.start_time = start; }
|
||||
if (end) { options.form.end_time = end; }
|
||||
options.form.num_max_events = max_events ? max_events : 1000;
|
||||
options.form.index_offset = offset ? offset : 0;
|
||||
options.form = JSON.stringify(options.form);
|
||||
logger.info({fileName: 'Switch', msg: 'Forwarding History Params: ' + options.form});
|
||||
request.post(options).then((body) => {
|
||||
logger.info({fileName: 'Switch', msg: 'Forwarding History Received: ' + JSON.stringify(body)});
|
||||
res.status(201).json(body);
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
logger.error({fileName: 'Switch', lineNum: 44, msg: 'Switch Post Error: ' + JSON.stringify(err)});
|
||||
return res.status(500).json({
|
||||
if(undefined === body || body.error) {
|
||||
logger.error({fileName: 'Switch', lineNum: 31, msg: 'Forwarding History Error: ' + JSON.stringify((undefined === body) ? 'Error From Server!' : body.error)});
|
||||
res.status(500).json({
|
||||
message: "Switch post failed!",
|
||||
error: (undefined === body) ? 'Error From Server!' : body.error
|
||||
});
|
||||
} else {
|
||||
if (undefined !== body.forwarding_events && body.forwarding_events.length > 0) {
|
||||
body.forwarding_events.forEach(event => {
|
||||
event.timestamp_str = (undefined === event.timestamp) ? '' : common.convertTimestampToDate(event.timestamp);
|
||||
});
|
||||
body.forwarding_events = common.sortDescByKey(body.forwarding_events, 'timestamp');
|
||||
}
|
||||
logger.info({fileName: 'Switch', msg: 'Forwarding History Before Resolve: ' + JSON.stringify(body)});
|
||||
resolve(body);
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
logger.error({fileName: 'Switch', lineNum: 48, msg: 'Forwarding History Error: ' + JSON.stringify(err)});
|
||||
resolve({
|
||||
message: "Switch post failed!",
|
||||
error: err.error
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
exports.forwardingHistory = (req, res, next) => {
|
||||
this.getAllForwardingEvents(req.body.start_time, req.body.end_time, 0, 1000).then(function(values) {
|
||||
logger.info({fileName: 'Switch', msg: 'All Forwarding Events: ' + JSON.stringify(values)});
|
||||
res.status(201).json(values);
|
||||
}).catch(err => {
|
||||
logger.error({fileName: 'Switch', lineNum: 60, msg: 'Get All Forwarding Events: ' + JSON.stringify(err)});
|
||||
res.status(500).json({
|
||||
message: "Switch post failed!",
|
||||
error: err.error
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user