From 9353a86e1441dde5140922358c5bcf9d22a05fd4 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 19 Nov 2016 11:22:10 -0800 Subject: [PATCH] modules: blockchain technology (tm). --- bench/coin.js | 2 +- lib/{chain => blockchain}/chain.js | 0 lib/{chain => blockchain}/chaindb.js | 0 lib/{chain => blockchain}/chainentry.js | 0 lib/{chain => blockchain}/coins.js | 0 lib/{chain => blockchain}/coinview.js | 0 lib/{chain => blockchain}/compress.js | 2 +- lib/{chain => blockchain}/index.js | 0 lib/{chain => blockchain}/layout-browser.js | 0 lib/{chain => blockchain}/layout.js | 0 lib/env.js | 17 ++++++++--------- lib/node/fullnode.js | 2 +- lib/node/spvnode.js | 2 +- lib/primitives/coin.js | 2 +- package.json | 2 +- 15 files changed, 14 insertions(+), 15 deletions(-) rename lib/{chain => blockchain}/chain.js (100%) rename lib/{chain => blockchain}/chaindb.js (100%) rename lib/{chain => blockchain}/chainentry.js (100%) rename lib/{chain => blockchain}/coins.js (100%) rename lib/{chain => blockchain}/coinview.js (100%) rename lib/{chain => blockchain}/compress.js (98%) rename lib/{chain => blockchain}/index.js (100%) rename lib/{chain => blockchain}/layout-browser.js (100%) rename lib/{chain => blockchain}/layout.js (100%) diff --git a/bench/coin.js b/bench/coin.js index 1516c64c..707c12d6 100644 --- a/bench/coin.js +++ b/bench/coin.js @@ -7,7 +7,7 @@ var assert = require('assert'); var scriptTypes = constants.scriptTypes; var bench = require('./bench'); var fs = require('fs'); -var Coins = require('../lib/chain/coins'); +var Coins = require('../lib/blockchain/coins'); var TX = require('../lib/primitives/tx'); var wtx = fs.readFileSync(__dirname + '/../test/data/wtx.hex', 'utf8'); diff --git a/lib/chain/chain.js b/lib/blockchain/chain.js similarity index 100% rename from lib/chain/chain.js rename to lib/blockchain/chain.js diff --git a/lib/chain/chaindb.js b/lib/blockchain/chaindb.js similarity index 100% rename from lib/chain/chaindb.js rename to lib/blockchain/chaindb.js diff --git a/lib/chain/chainentry.js b/lib/blockchain/chainentry.js similarity index 100% rename from lib/chain/chainentry.js rename to lib/blockchain/chainentry.js diff --git a/lib/chain/coins.js b/lib/blockchain/coins.js similarity index 100% rename from lib/chain/coins.js rename to lib/blockchain/coins.js diff --git a/lib/chain/coinview.js b/lib/blockchain/coinview.js similarity index 100% rename from lib/chain/coinview.js rename to lib/blockchain/coinview.js diff --git a/lib/chain/compress.js b/lib/blockchain/compress.js similarity index 98% rename from lib/chain/compress.js rename to lib/blockchain/compress.js index 963fc8fe..74fec2fb 100644 --- a/lib/chain/compress.js +++ b/lib/blockchain/compress.js @@ -89,7 +89,7 @@ function decompressScript(p, script) { /** * Compress value using an exponent. Takes advantage of * the fact that many bitcoin values are divisible by 10. - * @see https://github.com/btcsuite/btcd/blob/master/blockchain/compress.go + * @see https://github.com/btcsuite/btcd/blob/master/blockblockchain/compress.go * @param {Amount} value * @returns {Number} */ diff --git a/lib/chain/index.js b/lib/blockchain/index.js similarity index 100% rename from lib/chain/index.js rename to lib/blockchain/index.js diff --git a/lib/chain/layout-browser.js b/lib/blockchain/layout-browser.js similarity index 100% rename from lib/chain/layout-browser.js rename to lib/blockchain/layout-browser.js diff --git a/lib/chain/layout.js b/lib/blockchain/layout.js similarity index 100% rename from lib/chain/layout.js rename to lib/blockchain/layout.js diff --git a/lib/env.js b/lib/env.js index 29f11fee..57e3ef89 100644 --- a/lib/env.js +++ b/lib/env.js @@ -116,18 +116,18 @@ function Environment() { // Horrible BIP this.require('bip70', './bip70'); + // Blockchain + this.require('blockchain', './blockchain'); + this.require('chain', './blockchain/chain'); + this.require('chaindb', './blockchain/chaindb'); + this.require('chainentry', './blockchain/chainentry'); + // BTC this.require('btc', './btc'); this.require('amount', './btc/amount'); this.require('errors', './btc/errors'); this.require('uri', './btc/uri'); - // Chain - this.require('blockchain', './chain'); // -> blockchain? - this.require('chain', './chain/chain'); - this.require('chaindb', './chain/chaindb'); - this.require('chainentry', './chain/chainentry'); - // Crypto this.require('crypto', './crypto'); this.require('ec', './crypto/ec'); @@ -209,15 +209,14 @@ function Environment() { this.require('utils', './utils'); this.require('base58', './utils/base58'); this.require('co', './utils/co'); + this.require('encoding', './utils/encoding'); this.require('reader', './utils/reader'); this.require('util', './utils/util'); this.require('writer', './utils/writer'); // Wallet - this.require('wallet', './wallet'); // -> ? - this.require('account', './wallet/account'); + this.require('wallet', './wallet'); this.require('path', './wallet/path'); - this.require('masterkey', './wallet/masterkey'); this.require('walletkey', './wallet/walletkey'); this.require('walletdb', './wallet/walletdb'); diff --git a/lib/node/fullnode.js b/lib/node/fullnode.js index 6c54a6eb..05a57fb3 100644 --- a/lib/node/fullnode.js +++ b/lib/node/fullnode.js @@ -11,7 +11,7 @@ var constants = require('../protocol/constants'); var util = require('../utils/util'); var co = require('../utils/co'); var Node = require('./node'); -var Chain = require('../chain/chain'); +var Chain = require('../blockchain/chain'); var Fees = require('../mempool/fees'); var Mempool = require('../mempool/mempool'); var Pool = require('../net/pool'); diff --git a/lib/node/spvnode.js b/lib/node/spvnode.js index 22fba59b..67304589 100644 --- a/lib/node/spvnode.js +++ b/lib/node/spvnode.js @@ -10,7 +10,7 @@ var util = require('../utils/util'); var co = require('../utils/co'); var Node = require('./node'); -var Chain = require('../chain/chain'); +var Chain = require('../blockchain/chain'); var Pool = require('../net/pool'); var WalletDB = require('../wallet/walletdb'); var HTTPServer = require('../http/server'); diff --git a/lib/primitives/coin.js b/lib/primitives/coin.js index ba5c61a2..5031b534 100644 --- a/lib/primitives/coin.js +++ b/lib/primitives/coin.js @@ -17,7 +17,7 @@ var Script = require('../script/script'); var Network = require('../protocol/network'); var BufferWriter = require('../utils/writer'); var BufferReader = require('../utils/reader'); -var compressor = require('../chain/compress'); +var compressor = require('../blockchain/compress'); var compress = compressor.compress; var decompress = compressor.decompress; diff --git a/package.json b/package.json index b2d6642f..cda31bb1 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "./lib/db/backends": "./lib/db/backends-browser.js", "./lib/hd/wordlist": "./lib/hd/wordlist-browser.js", "./lib/net/tcp": "./lib/net/tcp-browser.js", - "./lib/chain/layout": "./lib/chain/layout-browser.js", + "./lib/blockchain/layout": "./lib/blockchain/layout-browser.js", "./lib/wallet/layout": "./lib/wallet/layout-browser.js", "fs": "./browser/empty.js", "crypto": "./browser/empty.js",