From 6b88f9e08dcdd04e1a7fd96dd6df93e3fa5f712f Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Sun, 23 Sep 2018 09:54:10 -0400 Subject: [PATCH] fixes for displaying addresses that have no transactions --- app/api/coreApi.js | 4 ++-- routes/baseActionsRouter.js | 6 ++++-- views/address.pug | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/api/coreApi.js b/app/api/coreApi.js index ee59390..05dd543 100644 --- a/app/api/coreApi.js +++ b/app/api/coreApi.js @@ -601,9 +601,9 @@ function getRawTransactionsWithInputs(txids, maxInputs=-1) { } } } - - resolve({ transactions:transactions, txInputsByTransaction:txInputsByTransaction }); }); + + resolve({ transactions:transactions, txInputsByTransaction:txInputsByTransaction }); }); }); }); diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index cffc576..a4bfc71 100644 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -604,9 +604,11 @@ router.get("/address/:address", function(req, res) { var pagedTxids = []; for (var i = offset; i < (offset + limit); i++) { - pagedTxids.push(txids[i]); + if (txids.length > i) { + pagedTxids.push(txids[i]); + } } - + coreApi.getRawTransactionsWithInputs(pagedTxids).then(function(rawTxResult) { res.locals.transactions = rawTxResult.transactions; res.locals.txInputsByTransaction = rawTxResult.txInputsByTransaction; diff --git a/views/address.pug b/views/address.pug index 622ff6e..6c52e65 100644 --- a/views/address.pug +++ b/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(class="font-weight-bold") #{electrumHistory.server} + if (!transactions || transactions.length == 0) + span No transactions found + if (transactions) each tx, txIndex in transactions //pre