diff --git a/routes/baseRouter.js b/routes/baseRouter.js index 6b7c4b61d..a80f0c4f9 100644 --- a/routes/baseRouter.js +++ b/routes/baseRouter.js @@ -26,6 +26,8 @@ const v8 = require('v8'); const forceCsrf = csurf({ ignoreMethods: [] }); +var noTxIndexMsg = "\n\nYour node does not have `txindex` enabled. Without it, you can only lookup wallet, mempool and recently confirmed transactions by their `txid`. Searching for non-wallet transactions that were confirmed more than "+config.noTxIndexSearchDepth+" blocks ago is only possible if you provide the confirmed block height in addition to the txid, using `@` in the search box."; + router.get("/", function(req, res, next) { if (req.session.host == null || req.session.host.trim() == "") { if (req.cookies['rpc-host']) { @@ -543,7 +545,8 @@ router.post("/search", function(req, res, next) { res.redirect("./block/" + query); }).catch(function(err) { req.session.userMessage = "No results found for query: " + query; - + if (global.getindexinfo && !global.getindexinfo.txindex) + req.session.userMessage += noTxIndexMsg; res.redirect("./"); }); }); @@ -854,6 +857,9 @@ router.get("/tx/:transactionId", function(req, res, next) { }).catch(function(err) { res.locals.userMessageMarkdown = `Failed to load transaction: txid=**${txid}**`; + if (global.getindexinfo && !global.getindexinfo.txindex) + res.locals.userMessageMarkdown += noTxIndexMsg; + res.locals.pageErrors.push(utils.logError("1237y4ewssgt", err)); res.render("transaction"); diff --git a/views/layout.pug b/views/layout.pug index 1a56b4593..05a383268 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -154,7 +154,7 @@ html(lang="en") if (userMessage) div.alert(class=(userMessageType ? `alert-${userMessageType}` : "alert-warning"), role="alert") - span #{userMessage} + | !{markdown(userMessage)} div(style="min-height: 500px;")