#!/usr/bin/env node

'use strict';

process.title = 'bcoin';

var bcoin = require('../');
var utils = bcoin.utils;
var assert = require('assert');

var options = bcoin.config({
  config: true,
  arg: true,
  env: true,
  logLevel: 'debug',
  logFile: true,
  db: 'leveldb',
  listen: true
});

bcoin.set(options);

var node = new bcoin.fullnode(options);

node.on('error', function(err) {
  ;
});

process.on('uncaughtException', function(err) {
  node.logger.debug(err.stack);
  node.logger.error(err);
  process.exit(1);
});

node.open().then(function() {
  node.pool.connect();
  node.startSync();
});
