From 2fdbdfc087ecca21653127b3a1f3397fb752e447 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 23 Jan 2017 03:03:38 -0800 Subject: [PATCH] network: remove `witness` field. --- lib/blockchain/chain.js | 6 ++---- lib/net/peer.js | 6 ++---- lib/net/pool.js | 2 +- lib/protocol/network.js | 1 - lib/protocol/networks.js | 20 ++------------------ migrate/chaindb1to2.js | 3 +-- 6 files changed, 8 insertions(+), 30 deletions(-) diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index 8591b22d..1b9f25d6 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -2304,7 +2304,7 @@ function ChainOptions(options) { this.bufferKeys = !util.isBrowser; this.spv = false; - this.witness = this.network.witness; + this.witness = true; this.prune = false; this.indexTX = false; this.indexAddress = false; @@ -2327,10 +2327,8 @@ function ChainOptions(options) { */ ChainOptions.prototype.fromOptions = function fromOptions(options) { - if (options.network != null) { + if (options.network != null) this.network = Network.get(options.network); - this.witness = this.network.witness; - } if (options.logger != null) { assert(typeof options.logger === 'object'); diff --git a/lib/net/peer.js b/lib/net/peer.js index fa59d96f..e60566c9 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -2159,7 +2159,7 @@ function PeerOptions(options) { this.noRelay = false; this.spv = false; this.compact = false; - this.witness = this.network.witness; + this.witness = true; this.headers = false; this.banScore = common.BAN_SCORE; @@ -2183,10 +2183,8 @@ function PeerOptions(options) { PeerOptions.prototype.fromOptions = function fromOptions(options) { assert(options, 'Options are required.'); - if (options.network != null) { + if (options.network != null) this.network = Network.get(options.network); - this.witness = this.network.witness; - } if (options.logger != null) { assert(typeof options.logger === 'object'); diff --git a/lib/net/pool.js b/lib/net/pool.js index d110aa81..ecb70376 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -3163,7 +3163,7 @@ function PoolOptions(options) { this.nonces = new NonceList(); this.address = new NetAddress(); - this.witness = this.network.witness; + this.witness = true; this.useCheckpoints = false; this.spv = false; this.listen = false; diff --git a/lib/protocol/network.js b/lib/protocol/network.js index dc124dab..42f14829 100644 --- a/lib/protocol/network.js +++ b/lib/protocol/network.js @@ -39,7 +39,6 @@ function Network(options) { this.pow = options.pow; this.block = options.block; this.bip30 = options.bip30; - this.witness = options.witness; this.activationThreshold = options.activationThreshold; this.minerWindow = options.minerWindow; this.deployments = options.deployments; diff --git a/lib/protocol/networks.js b/lib/protocol/networks.js index 61166706..ccf7da74 100644 --- a/lib/protocol/networks.js +++ b/lib/protocol/networks.js @@ -180,7 +180,7 @@ main.pow = { */ chainwork: new BN( - '0000000000000000000000000000000000000000002cb971dd56d1c583c20f90', + '0000000000000000000000000000000000000000003a315fa3a5ef47f4384cf2', 'hex' ), @@ -309,14 +309,6 @@ main.bip30 = { 91880: '21d77ccb4c08386a04ac0196ae10f6a1d2c2a377558ca190f143070000000000' }; -/** - * Whether this is a segwit-enabled network. - * @const {Boolean} - * @default - */ - -main.witness = true; - /** * For versionbits. * @const {Number} @@ -548,7 +540,7 @@ testnet.pow = { ), bits: 486604799, chainwork: new BN( - '0000000000000000000000000000000000000000000000198b4def2baa9338d6', + '00000000000000000000000000000000000000000000001e345893fa639796e9', 'hex' ), targetTimespan: 14 * 24 * 60 * 60, // two weeks @@ -573,8 +565,6 @@ testnet.block = { testnet.bip30 = {}; -testnet.witness = true; - testnet.activationThreshold = 1512; // 75% for testchains testnet.minerWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing @@ -724,8 +714,6 @@ regtest.block = { regtest.bip30 = {}; -regtest.witness = false; - regtest.activationThreshold = 108; // 75% for testchains regtest.minerWindow = 144; // Faster than normal for regtest (144 instead of 2016) @@ -876,8 +864,6 @@ segnet4.block = { segnet4.bip30 = {}; -segnet4.witness = true; - segnet4.activationThreshold = 108; segnet4.minerWindow = 144; @@ -1020,8 +1006,6 @@ simnet.block = { simnet.bip30 = {}; -simnet.witness = true; - simnet.activationThreshold = 1512; // 75% for testchains simnet.minerWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing diff --git a/migrate/chaindb1to2.js b/migrate/chaindb1to2.js index 7bbefeb3..6a7225a7 100644 --- a/migrate/chaindb1to2.js +++ b/migrate/chaindb1to2.js @@ -242,8 +242,7 @@ function defaultOptions() { if (options.spv) flags |= 1 << 0; - if (options.witness || options.network.witness) - flags |= 1 << 1; + flags |= 1 << 1; if (options.prune) flags |= 1 << 2;