Fixed txs per request to only save block w/ subdocs
This commit is contained in:
parent
e210e34dbc
commit
9045eacccd
@ -1,5 +1,5 @@
|
|||||||
const config = {
|
const config = {
|
||||||
start_node: true,
|
start_node: false,
|
||||||
logging: 'debug',
|
logging: 'debug',
|
||||||
bcoin: {
|
bcoin: {
|
||||||
network: 'main',
|
network: 'main',
|
||||||
|
|||||||
@ -39,17 +39,22 @@ function getTransactions(params, options, cb) {
|
|||||||
|
|
||||||
module.exports = function transactionAPI(router) {
|
module.exports = function transactionAPI(router) {
|
||||||
router.get('/tx/:txid', (req, res) => {
|
router.get('/tx/:txid', (req, res) => {
|
||||||
getTransactions(
|
getBlock(
|
||||||
{ hash: req.params.txid },
|
{ 'txs.hash': req.params.txid },
|
||||||
{ },
|
{ },
|
||||||
(err, tx) => {
|
MAX_BLOCKS,
|
||||||
|
(err, blocks) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
res.status(501).send();
|
res.status(501).send();
|
||||||
logger.log('err', err);
|
logger.log('err', err);
|
||||||
}
|
}
|
||||||
if (tx[0]) {
|
|
||||||
const t = tx[0];
|
|
||||||
|
|
||||||
|
if (blocks[0] && blocks[0].txs) {
|
||||||
|
let t = blocks[0].txs.filter(tx => tx.hash === req.params.txid);
|
||||||
|
t = t[0];
|
||||||
|
console.log(t);
|
||||||
|
console.log(t.inputs);
|
||||||
|
console.log(t.inputs);
|
||||||
// Map bcoin model to insight-api
|
// Map bcoin model to insight-api
|
||||||
res.json({
|
res.json({
|
||||||
txid: t.hash,
|
txid: t.hash,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user