indexes and experimenting with mem db
This commit is contained in:
parent
2ac70bc9a2
commit
1cb0a6b385
@ -4,7 +4,7 @@ const config = {
|
||||
bcoin_http: 'localhost',
|
||||
bcoin: {
|
||||
network: 'main',
|
||||
db: 'leveldb',
|
||||
db: 'mem',
|
||||
prefix: '.',
|
||||
checkpoints: true,
|
||||
workers: false,
|
||||
|
||||
@ -8,6 +8,8 @@ const TTL = config.api.request_ttl;
|
||||
module.exports = function AddressAPI(router) {
|
||||
router.get('/addr/:addr', (req, res) => {
|
||||
const addr = req.params.addr || '';
|
||||
logger.log('debug',
|
||||
'Warning: Requesting data from Bcoin by address, may take some time');
|
||||
// Get Bcoin data
|
||||
return request(`${API_URL}/tx/address/${addr}`,
|
||||
{ timeout: TTL },
|
||||
|
||||
@ -147,7 +147,7 @@ module.exports = function transactionAPI(router) {
|
||||
const addr = req.query.address || '';
|
||||
|
||||
logger.log('debug',
|
||||
'Warning: Requesting data from Bcoin, may take some time');
|
||||
'Warning: Requesting data from Bcoin by address, may take some time');
|
||||
|
||||
return request(`${API_URL}/tx/address/${addr}`,
|
||||
{ timeout: TTL },
|
||||
|
||||
@ -10,6 +10,8 @@ const InputSchema = new Schema({
|
||||
address: { type: String, default: '' },
|
||||
});
|
||||
|
||||
InputSchema.index({ address: 1 });
|
||||
|
||||
const Input = mongoose.model('Input', InputSchema);
|
||||
|
||||
module.exports = Input;
|
||||
|
||||
@ -9,6 +9,8 @@ const OutputSchema = new Schema({
|
||||
type: { type: String, default: '' },
|
||||
});
|
||||
|
||||
OutputSchema.index({ address: 1 });
|
||||
|
||||
const Output = mongoose.model('Output', OutputSchema);
|
||||
|
||||
module.exports = Output;
|
||||
|
||||
@ -22,6 +22,8 @@ const TransactionSchema = new Schema({
|
||||
network: { type: String, default: '' },
|
||||
});
|
||||
|
||||
TransactionSchema.index({ hash: 1 });
|
||||
|
||||
const Transaction = mongoose.model('Transaction', TransactionSchema);
|
||||
|
||||
module.exports = Transaction;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user