<commit_before>/**
 * chain.js - blockchain management for bcoin
 * Copyright (c) 2014-2015, <NAME> (MIT License)
 * https://github.com/indutny/bcoin
 */

var inherits = require('inherits');
var EventEmitter = require('events').EventEmitter;
var request = require('request');

var bcoin = require('../bcoin');
var bn = require('bn.js');
var constants = bcoin.protocol.constants;
var network = bcoin.protocol.network;
var utils = bcoin.utils;
var assert = utils.assert;
var fs = bcoin.fs;

/**
 * Chain
 */

function Chain(options) {
  if (!(this instanceof Chain))
    return new Chain(options);

  EventEmitter.call(this);

  if (!options)
    options = {};

  this.options = options;

  if (this.options.debug)
    bcoin.debug = this.options.debug;

  this.db = new bcoin.chaindb(this);
  this.request = new utils.RequestCache();
  this.loading = false;
  this.mempool = options.mempool;
  this.blockdb = options.blockdb;
  // this.locked = false;
  this.handling = false;
  this.busy = false;
  this.jobs = [];
  this.pending = [];
  this.pendingBlocks = {};
  this.pendingSize = 0;
  this.total = 0;
  this.orphanLimit = options.orphanLimit || 20 * 1024 * 1024;
  this.pendingLimit = options.pendingLimit || 20 * 1024 * 1024;
  this.invalid = {};
  this.bestHeight = -1;

  this.orphan = {
    map: {},
    bmap: {},
    count: 0,
    size: 0
  };

  Chain.global = this;

  this._init();<commit_msg>lower limits.<commit_after>/**
 * chain.js - blockchain management for bcoin
 * Copyright (c) 2014-2015, <NAME> (MIT License)
 * https://github.com/indutny/bcoin
 */

var inherits = require('inherits');
var EventEmitter = require('events').EventEmitter;
var request = require('request');

var bcoin = require('../bcoin');
var bn = require('bn.js');
var constants = bcoin.protocol.constants;
var network = bcoin.protocol.network;
var utils = bcoin.utils;
var assert = utils.assert;
var fs = bcoin.fs;

/**
 * Chain
 */

function Chain(options) {
  if (!(this instanceof Chain))
    return new Chain(options);

  EventEmitter.call(this);

  if (!options)
    options = {};

  this.options = options;

  if (this.options.debug)
    bcoin.debug = this.options.debug;

  this.db = new bcoin.chaindb(this);
  this.request = new utils.RequestCache();
  this.loading = false;
  this.mempool = options.mempool;
  this.blockdb = options.blockdb;
  // this.locked = false;
  this.handling = false;
  this.busy = false;
  this.jobs = [];
  this.pending = [];
  this.pendingBlocks = {};
  this.pendingSize = 0;
  this.total = 0;
  this.orphanLimit = options.orphanLimit || 10 * 1024 * 1024;
  this.pendingLimit = options.pendingLimit || 10 * 1024 * 1024;
  this.invalid = {};
  this.bestHeight = -1;

  this.orphan = {
    map: {},
    bmap: {},
    count: 0,
    size: 0
  };

  Chain.global = this;

  this._init();
{'fraction_non_alphanumeric': 0.15847578347578348, 'fraction_numerical': 0.023504273504273504, 'mean_word_length': 3.301684532924962, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2084541', 'n_tokens_mistral': 1014, 'n_tokens_neox': 943, 'n_words': 222}