Browse Source

-Armor/error handling for IBD node

-var name typo fix
master
Dan Janosik 5 years ago
parent
commit
c43eaedf9c
No known key found for this signature in database GPG Key ID: C6F8CE9FFDB2CED2
  1. 7
      app/api/coreApi.js
  2. 15
      routes/baseActionsRouter.js
  3. 11
      views/includes/index-network-summary.pug
  4. 11
      views/index.pug

7
app/api/coreApi.js

@ -242,6 +242,13 @@ function getTxCountStats(dataPtCount, blockStart, blockEnd) {
} }
Promise.all(promises).then(function(results) { Promise.all(promises).then(function(results) {
if (results[0].name == "RpcError" && results[0].code == -8) {
// recently started node - no meaningful data to return
resolve(null);
return;
}
var txStats = { var txStats = {
txCounts: [], txCounts: [],
txLabels: [], txLabels: [],

15
routes/baseActionsRouter.js

@ -122,16 +122,23 @@ router.get("/", function(req, res, next) {
res.locals.mempoolInfo = promiseResults[0]; res.locals.mempoolInfo = promiseResults[0];
res.locals.miningInfo = promiseResults[1]; res.locals.miningInfo = promiseResults[1];
var rawSmartFeeEsimates = promiseResults[2]; var rawSmartFeeEstimates = promiseResults[2];
var smartFeeEsimates = {}; var smartFeeEstimates = {};
for (var i = 0; i < feeConfTargets.length; i++) { for (var i = 0; i < feeConfTargets.length; i++) {
smartFeeEsimates[feeConfTargets[i]] = parseInt(new Decimal(rawSmartFeeEsimates[i].feerate).times(coinConfig.baseCurrencyUnit.multiplier).dividedBy(1000)); var rawSmartFeeEstimate = rawSmartFeeEstimates[i];
if (rawSmartFeeEstimate.errors) {
smartFeeEstimates[feeConfTargets[i]] = "?";
} else {
smartFeeEstimates[feeConfTargets[i]] = parseInt(new Decimal(rawSmartFeeEstimate.feerate).times(coinConfig.baseCurrencyUnit.multiplier).dividedBy(1000));
}
} }
res.locals.smartFeeEstimates = smartFeeEstimates;
res.locals.smartFeeEsimates = smartFeeEsimates;
res.locals.hashrate1d = promiseResults[3]; res.locals.hashrate1d = promiseResults[3];
res.locals.hashrate7d = promiseResults[4]; res.locals.hashrate7d = promiseResults[4];

11
views/includes/index-network-summary.pug

@ -67,14 +67,14 @@ div.row.index-summary
span.border-dotted(title="Current fee estimates (using 'estimatesmartfee') for getting a transaction included in 1 block, 6 blocks (1 hr), 144 blocks (1 day), or 1,008 blocks (1 week).", data-toggle="tooltip") Fee Targets span.border-dotted(title="Current fee estimates (using 'estimatesmartfee') for getting a transaction included in 1 block, 6 blocks (1 hr), 144 blocks (1 day), or 1,008 blocks (1 week).", data-toggle="tooltip") Fee Targets
if (false) if (false)
small.ml-1 (1/h/d/w) small.ml-1 (1/h/d/w)
td.text-right.text-monospace #{smartFeeEsimates[1]} td.text-right.text-monospace #{smartFeeEstimates[1]}
small.d-md-none small.d-md-none
small.text-muted / small.text-muted /
span #{smartFeeEsimates[6]} span #{smartFeeEstimates[6]}
small.text-muted / small.text-muted /
span #{smartFeeEsimates[144]} span #{smartFeeEstimates[144]}
small.text-muted / small.text-muted /
span #{smartFeeEsimates[1008]} span #{smartFeeEstimates[1008]}
small sat/vB small sat/vB
div(class=colClass) div(class=colClass)
@ -88,8 +88,11 @@ div.row.index-summary
//span Total Transactions //span Total Transactions
span Total Txs span Total Txs
td.text-right.text-monospace td.text-right.text-monospace
if (txStats && txStats.totalTxCount)
- var totalTxData = utils.formatLargeNumber(txStats.totalTxCount, 2); - var totalTxData = utils.formatLargeNumber(txStats.totalTxCount, 2);
span.border-dotted(title=`${txStats.totalTxCount.toLocaleString()}`, data-toggle="tooltip") #{totalTxData[0]} #{totalTxData[1].abbreviation} span.border-dotted(title=`${txStats.totalTxCount.toLocaleString()}`, data-toggle="tooltip") #{totalTxData[0]} #{totalTxData[1].abbreviation}
else
span ???
if (getblockchaininfo.size_on_disk) if (getblockchaininfo.size_on_disk)
- var sizeData = utils.formatLargeNumber(getblockchaininfo.size_on_disk, 2); - var sizeData = utils.formatLargeNumber(getblockchaininfo.size_on_disk, 2);

11
views/index.pug

@ -13,7 +13,7 @@ block content
else else
if (config.demoSite && session.hideHomepageBanner != "true") if (config.demoSite && session.hideHomepageBanner != "true")
div(class="alert alert-primary alert-dismissible shadow-sm mb-4", role="alert") div.alert.alert-primary.alert-dismissible.shadow-sm.mb-3(role="alert")
span span
strong #{coinConfig.siteTitle} strong #{coinConfig.siteTitle}
span is span is
@ -53,6 +53,15 @@ block content
a(href="/changeSetting?name=hideHomepageBanner&value=true", class="close", aria-label="Close", style="text-decoration: none;") a(href="/changeSetting?name=hideHomepageBanner&value=true", class="close", aria-label="Close", style="text-decoration: none;")
span(aria-hidden="true") &times; span(aria-hidden="true") &times;
if (getblockchaininfo.initialblockdownload)
div.alert.alert-warning.shadow-sm.border.mb-3
div.font-weight-bold.mb-1 Initial Block Download (IBD) - In Progress...
div.mb-1 Your node is currently downloading and verifying blockchain data. Until the process is finished, some features of this tool will be unusable and/or unreliable.
span.font-weight-bold Progress:
span.text-monospace #{new Decimal(getblockchaininfo.verificationprogress).times(100).toDP(3)}%
div.row div.row
- var summaryColCount = 8; - var summaryColCount = 8;

Loading…
Cancel
Save