Browse Source

fixes for displaying addresses that have no transactions

fix-133-memory-crash
Dan Janosik 6 years ago
parent
commit
6b88f9e08d
  1. 2
      app/api/coreApi.js
  2. 2
      routes/baseActionsRouter.js
  3. 3
      views/address.pug

2
app/api/coreApi.js

@ -601,12 +601,12 @@ function getRawTransactionsWithInputs(txids, maxInputs=-1) {
} }
} }
} }
});
resolve({ transactions:transactions, txInputsByTransaction:txInputsByTransaction }); resolve({ transactions:transactions, txInputsByTransaction:txInputsByTransaction });
}); });
}); });
}); });
});
} }
function getBlockByHashWithTransactions(blockHash, txLimit, txOffset) { function getBlockByHashWithTransactions(blockHash, txLimit, txOffset) {

2
routes/baseActionsRouter.js

@ -604,8 +604,10 @@ router.get("/address/:address", function(req, res) {
var pagedTxids = []; var pagedTxids = [];
for (var i = offset; i < (offset + limit); i++) { for (var i = offset; i < (offset + limit); i++) {
if (txids.length > i) {
pagedTxids.push(txids[i]); pagedTxids.push(txids[i]);
} }
}
coreApi.getRawTransactionsWithInputs(pagedTxids).then(function(rawTxResult) { coreApi.getRawTransactionsWithInputs(pagedTxids).then(function(rawTxResult) {
res.locals.transactions = rawTxResult.transactions; res.locals.transactions = rawTxResult.transactions;

3
views/address.pug

@ -220,6 +220,9 @@ block content
span The transaction history for this address was requested from mulitple ElectrumX servers and the results did not match. The results below were obtained only from span The transaction history for this address was requested from mulitple ElectrumX servers and the results did not match. The results below were obtained only from
span(class="font-weight-bold") #{electrumHistory.server} span(class="font-weight-bold") #{electrumHistory.server}
if (!transactions || transactions.length == 0)
span No transactions found
if (transactions) if (transactions)
each tx, txIndex in transactions each tx, txIndex in transactions
//pre //pre

Loading…
Cancel
Save