Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mempool summary views rendering #170

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions views/mempool-summary.pug
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,23 @@ block endOfBody
for (var i = 0; i < rawdata.length; i++) {
var txMempoolInfo = rawdata[i].entry;

var fee = txMempoolInfo.modifiedfee;
if (txMempoolInfo.modifiedfee) {
var fee = txMempoolInfo.modifiedfee;
}
else
{
var fee = txMempoolInfo.fees.modified;
}
var feePerByte = fee / size;
var size = txMempoolInfo.size;
var feePerByte = txMempoolInfo.modifiedfee / size;
var age = Date.now() / 1000 - txMempoolInfo.time;

if (fee > maxFee) {
maxFee = txMempoolInfo.modifiedfee;
maxFee = fee;
}

if (feePerByte > maxFeePerByte) {
maxFeePerByte = txMempoolInfo.modifiedfee / size;
maxFeePerByte = feePerByte;
}

ages.push({age:age, txid:"abc"});
Expand Down Expand Up @@ -485,9 +491,15 @@ block endOfBody
var satsMultiplier = !{coinConfig.baseCurrencyUnit.multiplier};
for (var x = 0; x < rawdata.length; x++) {
var txMempoolInfo = rawdata[x].entry;
var fee = txMempoolInfo.modifiedfee;
if (txMempoolInfo.modifiedfee) {
var fee = txMempoolInfo.modifiedfee;
}
else
{
var fee = txMempoolInfo.fees.modified;
}
var feePerByte = fee / size;
var size = txMempoolInfo.size;
var feePerByte = txMempoolInfo.modifiedfee / size;
var satoshiPerByte = feePerByte * satsMultiplier;
var age = Date.now() / 1000 - txMempoolInfo.time;

Expand All @@ -511,7 +523,14 @@ block endOfBody
}

summary["count"]++;
summary["totalFees"] += txMempoolInfo.modifiedfee;
if (txMempoolInfo.modifiedfee) {
summary["totalFees"] += txMempoolInfo.modifiedfee;
}
else
{
summary["totalFees"] += txMempoolInfo.fees.modified;
}

summary["totalBytes"] += size;

var ageBucketIndex = Math.min(ageBucketCount - 1, parseInt(age / (maxAge / ageBucketCount)));
Expand Down