leap-node
Version:
[](https://codecov.io/gh/leapdao/leap-node) [](https://quay.io/re
13 lines (11 loc) • 446 B
JavaScript
const getBlockByHash = require('./getBlockByHash');
module.exports = async (bridgeState, db, heightOrTag, showFullTxs = false) => {
let height = heightOrTag;
if (heightOrTag === 'latest') {
height = bridgeState.blockHeight;
} else if (typeof height === 'string' && height.indexOf('0x') === 0) {
height = parseInt(height, 16);
}
const blockDoc = await db.getBlock(height);
return getBlockByHash(db, blockDoc, showFullTxs);
};