2016-02-14 18:05:21 -08:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
2016-06-13 01:06:01 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
2016-07-30 13:53:43 -07:00
|
|
|
process.title = 'bcoin';
|
|
|
|
|
|
2016-10-02 01:01:16 -07:00
|
|
|
var assert = require('assert');
|
2017-01-14 07:18:47 -08:00
|
|
|
var bcoin = require('../');
|
|
|
|
|
var co = bcoin.co;
|
|
|
|
|
var options, node;
|
2016-02-14 18:05:21 -08:00
|
|
|
|
2017-01-14 07:18:47 -08:00
|
|
|
options = bcoin.config({
|
2016-07-29 15:40:39 -07:00
|
|
|
config: true,
|
|
|
|
|
arg: true,
|
|
|
|
|
env: true,
|
2016-07-04 05:36:06 -07:00
|
|
|
logLevel: 'debug',
|
|
|
|
|
logFile: true,
|
|
|
|
|
db: 'leveldb',
|
2016-07-29 15:40:39 -07:00
|
|
|
listen: true
|
2016-02-14 18:05:21 -08:00
|
|
|
});
|
|
|
|
|
|
2016-07-29 15:40:39 -07:00
|
|
|
bcoin.set(options);
|
|
|
|
|
|
2017-01-14 07:18:47 -08:00
|
|
|
node = new bcoin.fullnode(options);
|
2016-07-29 15:40:39 -07:00
|
|
|
|
2016-02-14 18:05:21 -08:00
|
|
|
node.on('error', function(err) {
|
2016-07-04 05:36:06 -07:00
|
|
|
;
|
2016-02-14 18:05:21 -08:00
|
|
|
});
|
2016-03-22 17:36:58 -07:00
|
|
|
|
2016-07-29 15:40:39 -07:00
|
|
|
process.on('uncaughtException', function(err) {
|
|
|
|
|
node.logger.debug(err.stack);
|
|
|
|
|
node.logger.error(err);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
});
|
|
|
|
|
|
2017-01-14 07:18:47 -08:00
|
|
|
co.spawn(function *() {
|
|
|
|
|
yield node.open();
|
|
|
|
|
yield node.connect();
|
2016-07-29 15:40:39 -07:00
|
|
|
node.startSync();
|
2017-01-14 07:18:47 -08:00
|
|
|
}).catch(function(err) {
|
|
|
|
|
throw err;
|
2016-03-22 17:36:58 -07:00
|
|
|
});
|