Browse Source

better handling for node-initialization and rpc-error issues on homepage

fix-133-memory-crash
Dan Janosik 6 years ago
parent
commit
df7fb91312
No known key found for this signature in database GPG Key ID: C6F8CE9FFDB2CED2
  1. 349
      views/index.pug

349
views/index.pug

@ -7,211 +7,218 @@ block content
h1(class="h3") #{coinConfig.siteTitle} h1(class="h3") #{coinConfig.siteTitle}
hr hr
if (config.demoSite && session.hideHomepageBanner != "true") if (getblockchaininfo == null)
div(class="alert alert-primary alert-dismissible shadow-sm mb-4", role="alert") div(class="alert alert-warning")
span p(class="font-weight-bold") Unable to get basic blockchain data
strong #{coinConfig.siteTitle} ul
span is li If you just started your node, it may still be initializing.
a(href="https://github.com/janoside/btc-rpc-explorer", target="_blank") open-source li If your node is already initialized, check your RPC connection info.
span and easy to set up. It can communicate with your else
a(href=coinConfig.nodeUrl, target="_blank") #{coinConfig.name} Full Node
span via RPC. See the if (config.demoSite && session.hideHomepageBanner != "true")
a(href="https://github.com/janoside/btc-rpc-explorer", target="_blank") project description div(class="alert alert-primary alert-dismissible shadow-sm mb-4", role="alert")
span for a list of features and instructions for running. span
strong #{coinConfig.siteTitle}
if (global.sourcecodeProjectMetadata) span is
div(class="mt-2") a(href="https://github.com/janoside/btc-rpc-explorer", target="_blank") open-source
a(href="https://github.com/janoside/btc-rpc-explorer", class="btn btn-primary mr-3 mb-1") span and easy to set up. It can communicate with your
i(class="fas fa-star mr-2") a(href=coinConfig.nodeUrl, target="_blank") #{coinConfig.name} Full Node
span(class="mr-2") Star span via RPC. See the
span.font-weight-light #{global.sourcecodeProjectMetadata.stargazers_count} a(href="https://github.com/janoside/btc-rpc-explorer", target="_blank") project description
span for a list of features and instructions for running.
a(href="https://github.com/janoside/btc-rpc-explorer/fork", class="btn btn-primary mr-3 mb-1")
i(class="fas fa-code-branch mr-2") if (global.sourcecodeProjectMetadata)
span(class="mr-2") Fork div(class="mt-2")
span.font-weight-light #{global.sourcecodeProjectMetadata.forks_count} a(href="https://github.com/janoside/btc-rpc-explorer", class="btn btn-primary mr-3 mb-1")
i(class="fas fa-star mr-2")
button.btn.btn-primary(type="button", class="btn btn-primary mb-1", data-toggle="modal", data-target="#exampleModalCenter") span(class="mr-2") Star
i(class="fas fa-heart mr-2") span.font-weight-light #{global.sourcecodeProjectMetadata.stargazers_count}
span Donate via
span(class="font-weight-light") BTCPay a(href="https://github.com/janoside/btc-rpc-explorer/fork", class="btn btn-primary mr-3 mb-1")
i(class="fas fa-code-branch mr-2")
span(class="mr-2") Fork
span.font-weight-light #{global.sourcecodeProjectMetadata.forks_count}
a(href="/changeSetting?name=hideHomepageBanner&value=true", class="close", aria-label="Close", style="text-decoration: none;")
span(aria-hidden="true") × button.btn.btn-primary(type="button", class="btn btn-primary mb-1", data-toggle="modal", data-target="#exampleModalCenter")
i(class="fas fa-heart mr-2")
span Donate via
span(class="font-weight-light") BTCPay
- var networkSummaryItemCount = 4; a(href="/changeSetting?name=hideHomepageBanner&value=true", class="close", aria-label="Close", style="text-decoration: none;")
span(aria-hidden="true") ×
if (getblockchaininfo.size_on_disk)
- networkSummaryItemCount++;
if (global.exchangeRates) - var networkSummaryItemCount = 4;
- networkSummaryItemCount++;
if (txStats) if (getblockchaininfo.size_on_disk)
- networkSummaryItemCount++; - networkSummaryItemCount++;
- var networkSummaryColumnClass = "col-md-4"; if (global.exchangeRates)
if (networkSummaryItemCount > 6) - networkSummaryItemCount++;
- networkSummaryColumnClass = "col-md-3";
div(class="card mb-4 shadow-sm")
div(class="card-header")
h2(class="h6 mb-0") Network Summary
div(class="card-body")
div(class="row")
div(class=networkSummaryColumnClass)
div(class="float-left", style="height: 40px; width: 40px;")
span
i(class="fas fa-tachometer-alt fa-2x mr-2", style="margin-top: 6px;")
- var hashrateData = utils.formatLargeNumber(miningInfo.networkhashps, 3);
span(class="font-weight-bold") Hashrate
p(class="lead") if (txStats)
span #{hashrateData[0]} - networkSummaryItemCount++;
span(title=(hashrateData[1].name + "-hash / x10^" + hashrateData[1].exponent), data-toggle="tooltip") #{hashrateData[1].abbreviation}H/s
if (txStats) - var networkSummaryColumnClass = "col-md-4";
if (networkSummaryItemCount > 6)
- networkSummaryColumnClass = "col-md-3";
div(class="card mb-4 shadow-sm")
div(class="card-header")
h2(class="h6 mb-0") Network Summary
div(class="card-body")
div(class="row")
div(class=networkSummaryColumnClass) div(class=networkSummaryColumnClass)
div(class="float-left", style="height: 40px; width: 40px;") div(class="float-left", style="height: 40px; width: 40px;")
span span
i(class="fas fa-sign-out-alt fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;") i(class="fas fa-tachometer-alt fa-2x mr-2", style="margin-top: 6px;")
- var hashrateData = utils.formatLargeNumber(miningInfo.networkhashps, 3);
span(class="font-weight-bold") Hashrate
span(class="font-weight-bold") Total Transactions p(class="lead")
span #{hashrateData[0]}
span(title=(hashrateData[1].name + "-hash / x10^" + hashrateData[1].exponent), data-toggle="tooltip") #{hashrateData[1].abbreviation}H/s
p(class="lead") #{txStats.totalTxCount.toLocaleString()} if (txStats)
div(class=networkSummaryColumnClass)
div(class="float-left", style="height: 40px; width: 40px;")
span
i(class="fas fa-sign-out-alt fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;")
div(class=networkSummaryColumnClass) span(class="font-weight-bold") Total Transactions
div(class="float-left", style="height: 40px; width: 40px;")
span
i(class="fas fa-unlock-alt fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;")
span(class="font-weight-bold") Unconfirmed Transactions p(class="lead") #{txStats.totalTxCount.toLocaleString()}
p(class="lead") #{mempoolInfo.size.toLocaleString()} tx div(class=networkSummaryColumnClass)
- var mempoolBytesData = utils.formatLargeNumber(mempoolInfo.usage, 2); div(class="float-left", style="height: 40px; width: 40px;")
small(class="text-muted font-weight-light") (#{mempoolBytesData[0]} #{mempoolBytesData[1].abbreviation}B) span
i(class="fas fa-unlock-alt fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;")
div(class=networkSummaryColumnClass) span(class="font-weight-bold") Unconfirmed Transactions
div(class="float-left", style="height: 40px; width: 40px;")
span p(class="lead") #{mempoolInfo.size.toLocaleString()} tx
i(class="fas fa-bolt fa-2x mr-2", style="margin-top: 6px; margin-left: 6px;") - var mempoolBytesData = utils.formatLargeNumber(mempoolInfo.usage, 2);
small(class="text-muted font-weight-light") (#{mempoolBytesData[0]} #{mempoolBytesData[1].abbreviation}B)
- var chainworkData = utils.formatLargeNumber(parseInt("0x" + getblockchaininfo.chainwork), 2);
span(class="font-weight-bold") Chainwork
p(class="lead")
span(data-toggle="tooltip", title=getblockchaininfo.chainwork.replace(/^0+/, ''))
span #{chainworkData[0]}
span x 10
sup #{chainworkData[1].exponent}
span hashes
div(class=networkSummaryColumnClass)
div(class="float-left", style="height: 40px; width: 40px; font-size: 12px;")
span
i(class="fas fa-dumbbell fa-2x mr-2", style="margin-top: 6px;")
- var difficultyData = utils.formatLargeNumber(getblockchaininfo.difficulty, 3);
span(class="font-weight-bold") Difficulty
p(class="lead")
span(title=parseFloat(getblockchaininfo.difficulty).toLocaleString(), data-toggle="tooltip")
span #{difficultyData[0]}
span x 10
sup #{difficultyData[1].exponent}
if (getblockchaininfo.size_on_disk)
div(class=networkSummaryColumnClass) div(class=networkSummaryColumnClass)
div(class="float-left", style="height: 40px; width: 40px;") div(class="float-left", style="height: 40px; width: 40px;")
span span
i(class="fas fa-database fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;") i(class="fas fa-bolt fa-2x mr-2", style="margin-top: 6px; margin-left: 6px;")
span(class="font-weight-bold") Blockchain Size
- var sizeData = utils.formatLargeNumber(getblockchaininfo.size_on_disk, 2); - var chainworkData = utils.formatLargeNumber(parseInt("0x" + getblockchaininfo.chainwork), 2);
p(class="lead") #{sizeData[0]} #{sizeData[1].abbreviation}B span(class="font-weight-bold") Chainwork
if (global.exchangeRates) p(class="lead")
span(data-toggle="tooltip", title=getblockchaininfo.chainwork.replace(/^0+/, ''))
span #{chainworkData[0]}
span x 10
sup #{chainworkData[1].exponent}
span hashes
div(class=networkSummaryColumnClass) div(class=networkSummaryColumnClass)
div(class="float-left", style="height: 40px; width: 40px; font-size: 12px;") div(class="float-left", style="height: 40px; width: 40px; font-size: 12px;")
span span
i(class="fas fa-money-bill-wave-alt fa-2x mr-2", style="margin-top: 7px;") i(class="fas fa-dumbbell fa-2x mr-2", style="margin-top: 6px;")
span(class="font-weight-bold") Exchange Rate - var difficultyData = utils.formatLargeNumber(getblockchaininfo.difficulty, 3);
span(data-toggle="tooltip", title=("Exchange-rate data from: " + coinConfig.exchangeRateData.jsonUrl))
i(class="fas fa-info-circle")
if (global.exchangeRates) span(class="font-weight-bold") Difficulty
p(class="lead") #{utils.formatExchangedCurrency(1.0, "usd")}
else
p(class="lead") -
p(class="lead")
span(title=parseFloat(getblockchaininfo.difficulty).toLocaleString(), data-toggle="tooltip")
span #{difficultyData[0]}
span x 10
sup #{difficultyData[1].exponent}
include includes/tools-card.pug if (getblockchaininfo.size_on_disk)
div(class=networkSummaryColumnClass)
if (latestBlocks) div(class="float-left", style="height: 40px; width: 40px;")
div(class="card mb-4 shadow-sm") span
div(class="card-header") i(class="fas fa-database fa-2x mr-2", style="margin-top: 6px; margin-left: 3px;")
div(class="row") span(class="font-weight-bold") Blockchain Size
div(class="col")
h2(class="h6 mb-0") Latest Blocks
if (getblockchaininfo.initialblockdownload)
small (#{(getblockchaininfo.headers - getblockchaininfo.blocks).toLocaleString()} behind)
div(class="col") - var sizeData = utils.formatLargeNumber(getblockchaininfo.size_on_disk, 2);
span(style="float: right;") p(class="lead") #{sizeData[0]} #{sizeData[1].abbreviation}B
a(href="/blocks")
span Browse Blocks »
div(class="card-body") if (global.exchangeRates)
div(class=networkSummaryColumnClass)
- var blocks = latestBlocks; div(class="float-left", style="height: 40px; width: 40px; font-size: 12px;")
- var blockOffset = 0; span
i(class="fas fa-money-bill-wave-alt fa-2x mr-2", style="margin-top: 7px;")
include includes/blocks-list.pug span(class="font-weight-bold") Exchange Rate
span(data-toggle="tooltip", title=("Exchange-rate data from: " + coinConfig.exchangeRateData.jsonUrl))
i(class="fas fa-info-circle")
if (global.exchangeRates)
p(class="lead") #{utils.formatExchangedCurrency(1.0, "usd")}
else
p(class="lead") -
if (txStats)
div(class="card mb-4 shadow-sm")
div(class="card-header")
div(class="row")
div(class="col")
h2(class="h6 mb-0") Transaction Stats Summary
div(class="col") include includes/tools-card.pug
span(style="float: right;")
a(href="/tx-stats")
span Transaction Stats »
div(class="card-body") if (latestBlocks)
if (true) div(class="card mb-4 shadow-sm")
div(class="card-header")
div(class="row")
div(class="col")
h2(class="h6 mb-0") Latest Blocks
if (getblockchaininfo.initialblockdownload)
small (#{(getblockchaininfo.headers - getblockchaininfo.blocks).toLocaleString()} behind)
div(class="col")
span(style="float: right;")
a(href="/blocks")
span Browse Blocks »
div(class="card-body")
- var blocks = latestBlocks;
- var blockOffset = 0;
include includes/blocks-list.pug
if (txStats)
div(class="card mb-4 shadow-sm")
div(class="card-header")
div(class="row") div(class="row")
div(class="col-lg-6") div(class="col")
div(class="table-responsive") h2(class="h6 mb-0") Transaction Stats Summary
table(class="table text-right mb-4 mb-lg-0")
thead div(class="col")
tr span(style="float: right;")
th Period a(href="/tx-stats")
th Transactions span Transaction Stats »
th Transactions Per Sec
tbody div(class="card-body")
each item, index in chainTxStats if (true)
tr(class="monospace") div(class="row")
td #{chainTxStatsLabels[index]} div(class="col-lg-6")
td #{item.window_tx_count.toLocaleString()} div(class="table-responsive")
td #{new Decimal(item.txrate).toDecimalPlaces(4)} table(class="table text-right mb-4 mb-lg-0")
thead
tr
div(class="col-lg-6") th Period
script var txRateDataDay = []; th Transactions
each item, index in txStats.txCountStats.txRates th Transactions Per Sec
script txRateDataDay.push({x:#{item.x}, y:#{item.y}}); tbody
each item, index in chainTxStats
- var graphData = {id:"graphRateDay", dataVar:"txRateDataDay", labels:txStats.txCountStats.txLabels, title:"Tx Rate, 24hr", xaxisTitle:"Block", xaxisStep:5, yaxisTitle:"Tx Per Sec"}; tr(class="monospace")
include ./includes/line-graph.pug td #{chainTxStatsLabels[index]}
td #{item.window_tx_count.toLocaleString()}
td #{new Decimal(item.txrate).toDecimalPlaces(4)}
div(class="col-lg-6")
script var txRateDataDay = [];
each item, index in txStats.txCountStats.txRates
script txRateDataDay.push({x:#{item.x}, y:#{item.y}});
- var graphData = {id:"graphRateDay", dataVar:"txRateDataDay", labels:txStats.txCountStats.txLabels, title:"Tx Rate, 24hr", xaxisTitle:"Block", xaxisStep:5, yaxisTitle:"Tx Per Sec"};
include ./includes/line-graph.pug
Loading…
Cancel
Save