47 lines
874 B
JavaScript
Executable File
47 lines
874 B
JavaScript
Executable File
#!/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'
|
|
});
|
|
|
|
bcoin.set(options);
|
|
|
|
var node = bcoin.spvnode(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() {
|
|
if (process.argv.indexOf('--test') !== -1) {
|
|
node.pool.watchAddress('1VayNert3x1KzbpzMGt2qdqrAThiRovi8');
|
|
node.pool.watch(bcoin.outpoint().toRaw());
|
|
node.on('block', function(block) {
|
|
assert(block.txs.length >= 1);
|
|
if (block.txs.length > 1)
|
|
utils.log(block.txs[1]);
|
|
});
|
|
}
|
|
|
|
node.startSync();
|
|
});
|