You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 lines
1.2 KiB

var debug = require("debug");
var debugLog = debug("btcexp:router");
var express = require('express');
var csurf = require('csurf');
var router = express.Router();
var util = require('util');
var moment = require('moment');
var bitcoinCore = require("bitcoin-core");
var qrcode = require('qrcode');
var bitcoinjs = require('bitcoinjs-lib');
var sha256 = require("crypto-js/sha256");
var hexEnc = require("crypto-js/enc-hex");
var Decimal = require("decimal.js");
var marked = require("marked");
var utils = require('./../app/utils.js');
var coins = require("./../app/coins.js");
var config = require("./../app/config.js");
var coreApi = require("./../app/api/coreApi.js");
var addressApi = require("./../app/api/addressApi.js");
const forceCsrf = csurf({ ignoreMethods: [] });
router.get("/blocks-by-height/:blockHeights", function(req, res, next) {
var blockHeightStrs = req.params.blockHeights.split(",");
var blockHeights = [];
for (var i = 0; i < blockHeightStrs.length; i++) {
blockHeights.push(parseInt(blockHeightStrs[i]));
}
coreApi.getBlocksByHeight(blockHeights).then(function(result) {
res.json(result);
next();
});
});
module.exports = router;