fcoin/lib/mempool/layout-browser.js
2017-02-28 09:20:23 -08:00

34 lines
507 B
JavaScript

/*!
* layout-browser.js - mempooldb layout for browser.
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/
'use strict';
var util = require('../utils/util');
var pad32 = util.pad32;
var layout = {
R: 'R',
e: function e(id, hash) {
return 'e' + pad32(id) + hex(hash);
}
};
/*
* Helpers
*/
function hex(hash) {
if (typeof hash !== 'string')
hash = hash.toString('hex');
return hash;
}
/*
* Expose
*/
module.exports = layout;