Fix return val in transactions.js for bestBlockHeight
This commit is contained in:
parent
ad39b6337c
commit
958fc79204
@ -11,13 +11,12 @@ module.exports = function transactionAPI(router) {
|
|||||||
router.get('/tx/:txid', (req, res) => {
|
router.get('/tx/:txid', (req, res) => {
|
||||||
// Get max block height for calculating confirmations
|
// Get max block height for calculating confirmations
|
||||||
db.blocks.getBestHeight(
|
db.blocks.getBestHeight(
|
||||||
(err, block) => {
|
(err, blockHeight) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.log('err', err);
|
logger.log('err', err);
|
||||||
return res.status(404).send();
|
return res.status(404).send();
|
||||||
}
|
}
|
||||||
|
const height = blockHeight;
|
||||||
const height = block.height;
|
|
||||||
// Bcoin transaction data
|
// Bcoin transaction data
|
||||||
return request(`${API_URL}/tx/${req.params.txid}`, (error, localRes, tx) => {
|
return request(`${API_URL}/tx/${req.params.txid}`, (error, localRes, tx) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -70,13 +69,14 @@ module.exports = function transactionAPI(router) {
|
|||||||
const rangeEnd = rangeStart + MAX_TXS;
|
const rangeEnd = rangeStart + MAX_TXS;
|
||||||
// get txs for blockhash, start with best height to calc confirmations
|
// get txs for blockhash, start with best height to calc confirmations
|
||||||
if (req.query.block) {
|
if (req.query.block) {
|
||||||
|
|
||||||
db.blocks.getBestHeight(
|
db.blocks.getBestHeight(
|
||||||
(err, block) => {
|
(err, blockHeight) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.log('err', err);
|
logger.log('err', err);
|
||||||
return res.status(404).send();
|
return res.status(404).send();
|
||||||
}
|
}
|
||||||
const height = block.height;
|
const height = blockHeight;
|
||||||
// Get Bcoin data
|
// Get Bcoin data
|
||||||
return request(`${API_URL}/block/${req.query.block}`, (error, localRes, block) => {
|
return request(`${API_URL}/block/${req.query.block}`, (error, localRes, block) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -123,13 +123,13 @@ module.exports = function transactionAPI(router) {
|
|||||||
} else if (req.query.address) {
|
} else if (req.query.address) {
|
||||||
// Get txs by address, start with best height to calc confirmations
|
// Get txs by address, start with best height to calc confirmations
|
||||||
db.blocks.getBestHeight(
|
db.blocks.getBestHeight(
|
||||||
(err, block) => {
|
(err, blockHeight) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.log('err', err);
|
logger.log('err', err);
|
||||||
return res.status(404).send();
|
return res.status(404).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
const height = block.height;
|
const height = blockHeight;
|
||||||
const addr = req.query.address || '';
|
const addr = req.query.address || '';
|
||||||
|
|
||||||
return request(`${API_URL}/tx/address/${req.query.address}`, (error, localRes, txs) => {
|
return request(`${API_URL}/tx/address/${req.query.address}`, (error, localRes, txs) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user