fixed search by addr checking for address. Eventually move these to middleware

This commit is contained in:
tenthirtyone 2017-08-21 22:57:43 -04:00
parent 98164e4447
commit e5ad52f55d
2 changed files with 8 additions and 2 deletions

View File

@ -11,7 +11,13 @@ module.exports = function AddressAPI(router) {
router.get('/addr/:addr', (req, res) => {
const addr = req.params.addr || '';
db.txs.getTxByAddress(addr, 0, 999999999, (error, txs) => {
if (!util.isBitcoinAddress(addr)) {
return res.status(404).send({
error: 'Invalid bitcoin address',
});
}
return db.txs.getTxByAddress(addr, 0, 999999999, (error, txs) => {
if (error) {
logger.log('error',
`getTxByBlock ${error}`);

View File

@ -7,7 +7,7 @@ module.exports = function BlockAPI(router) {
const blockHash = req.params.blockHash;
if (!util.isBlockHash(blockHash)) {
return res.status(400).send({
return res.status(404).send({
error: 'Invalid bitcoin address',
});
}