src/node/spvnode.js
function SPVNode(options) {
  if (!(this instanceof SPVNode))
    return new SPVNode(options);

  Node.call(this, options);

  // SPV flag.
  this.spv = true;

  this.chain = new Chain({
    network: this.network,
    logger: this.logger,
    db: this.config.str('db'),
    prefix: this.config.prefix,
    maxFiles: this.config.uint('max-files'),
    cacheSize: this.config.mb('cache-size'),
    entryCache: this.config.uint('entry-cache'),
    forceFlags: this.config.bool('force-flags'),
    checkpoints: this.config.bool('checkpoints'),
    bip91: this.config.bool('bip91'),
    bip148: this.config.bool('bip148'),
    spv: true
  });

  this.pool = new Pool({
    network: this.network,
    logger: this.logger,
    chain: this.chain,
    prefix: this.config.prefix,
    proxy: this.config.str('proxy'),
    onion: this.config.bool('onion'),
    upnp: this.config.bool('upnp'),
    seeds: this.config.array('seeds'),
    nodes: this.config.array('nodes'),
    only: this.config.array('only'),
    bip151: this.config.bool('bip151'),
    bip150: this.config.bool('bip150'),
    identityKey: this.config.buf('identity-key'),
    maxOutbound: this.config.uint('max-outbound'),
    persistent: this.config.bool('persistent'),
    selfish: true,
    listen: false
  });

  this.rpc = new RPC(this);

  if (!HTTPServer.unsupported) {
    this.http = new HTTPServer({
      network: this.network,
      logger: this.logger,
      node: this,
      prefix: this.config.prefix,
      ssl: this.config.bool('ssl'),
      keyFile: this.config.path('ssl-key'),
      certFile: this.config.path('ssl-cert'),
      host: this.config.str('http-host'),
      port: this.config.uint('http-port'),
      apiKey: this.config.str('api-key'),
      noAuth: this.config.bool('no-auth')
    });
  }

  this.rescanJob = null;
  this.scanLock = new Lock();
  this.watchLock = new Lock();

  this._init();
}
function SPVNode(options) {
  if (!(this instanceof SPVNode))
    return new SPVNode(options);

  Node.call(this, options);

  // SPV flag.
  this.spv = true;

  this.chain = new Chain({
    network: this.network,
    logger: this.logger,
    db: this.config.str('db'),
    prefix: this.config.prefix,
    maxFiles: this.config.uint('max-files'),
    cacheSize: this.config.mb('cache-size'),
    entryCache: this.config.uint('entry-cache'),
    forceFlags: this.config.bool('force-flags'),
    checkpoints: this.config.bool('checkpoints'),
    bip91: this.config.bool('bip91'),
    bip148: this.config.bool('bip148'),
    spv: true
  });

  this.pool = new Pool({
    network: this.network,
    logger: this.logger,
    chain: this.chain,
    prefix: this.config.prefix,
    proxy: this.config.str('proxy'),
    onion: this.config.bool('onion'),
    upnp: this.config.bool('upnp'),
    seeds: this.config.array('seeds'),
    nodes: this.config.array('nodes'),
    only: this.config.array('only'),
    bip151: this.config.bool('bip151'),
    bip150: this.config.bool('bip150'),
    identityKey: this.config.buf('identity-key'),
    maxOutbound: this.config.uint('max-outbound'),
    persistent: this.config.bool('persistent'),
    selfish: true,
    listen: false
  });

  this.rpc = new RPC(this);

  if (!HTTPServer.unsupported) {
    this.http = new HTTPServer({
      network: this.network,
      logger: this.logger,
      node: this,
      prefix: this.config.prefix,
      ssl: this.config.bool('ssl'),
      keyFile: this.config.path('ssl-key'),
      certFile: this.config.path('ssl-cert'),
      host: this.config.str('http-host'),
      port: this.config.uint('http-port'),
      apiKey: this.config.str('api-key'),
      noAuth: this.config.bool('no-auth')
    });
  }

  this.rescanJob = null;
  this.scanLock = new Lock();
  this.watchLock = new Lock();

  this._init();
}
function SPVNode ( options ) { if ( ! ( this instanceof SPVNode ) ) return new SPVNode ( options ) ; Node . call ( this , options ) ; // SPV flag. this . spv = true ; this . chain = new Chain ( { network : this . network , logger : this . logger , db : this . config . str ( 'db' ) , prefix : this . config . prefix , maxFiles : this . config . uint ( 'max-files' ) , cacheSize : this . config . mb ( 'cache-size' ) , entryCache : this . config . uint ( 'entry-cache' ) , forceFlags : this . config . bool ( 'force-flags' ) , checkpoints : this . config . bool ( 'checkpoints' ) , bip91 : this . config . bool ( 'bip91' ) , bip148 : this . config . bool ( 'bip148' ) , spv : true } ) ; this . pool = new Pool ( { network : this . network , logger : this . logger , chain : this . chain , prefix : this . config . prefix , proxy : this . config . str ( 'proxy' ) , onion : this . config . bool ( 'onion' ) , upnp : this . config . bool ( 'upnp' ) , seeds : this . config . array ( 'seeds' ) , nodes : this . config . array ( 'nodes' ) , only : this . config . array ( 'only' ) , bip151 : this . config . bool ( 'bip151' ) , bip150 : this . config . bool ( 'bip150' ) , identityKey : this . config . buf ( 'identity-key' ) , maxOutbound : this . config . uint ( 'max-outbound' ) , persistent : this . config . bool ( 'persistent' ) , selfish : true , listen : false } ) ; this . rpc = new RPC ( this ) ; if ( ! HTTPServer . unsupported ) { this . http = new HTTPServer ( { network : this . network , logger : this . logger , node : this , prefix : this . config . prefix , ssl : this . config . bool ( 'ssl' ) , keyFile : this . config . path ( 'ssl-key' ) , certFile : this . config . path ( 'ssl-cert' ) , host : this . config . str ( 'http-host' ) , port : this . config . uint ( 'http-port' ) , apiKey : this . config . str ( 'api-key' ) , noAuth : this . config . bool ( 'no-auth' ) } ) ; } this . rescanJob = null ; this . scanLock = new Lock ( ) ; this . watchLock = new Lock ( ) ; this . _init ( ) ; }
Create an spv node which only maintains
a chain, a pool, and an http server.
@alias module:node.SPVNode
@extends Node
@constructor
@param {Object?} options
@param {Buffer?} options.sslKey
@param {Buffer?} options.sslCert
@param {Number?} options.httpPort
@param {String?} options.httpHost
@property {Boolean} loaded
@property {Chain} chain
@property {Pool} pool
@property {HTTPServer} http
@emits SPVNode#block
@emits SPVNode#tx
@emits SPVNode#error
Create an spv node which only maintains a chain a pool and an http server .