network: remove witness field.

This commit is contained in:
Christopher Jeffrey 2017-01-23 03:03:38 -08:00
parent 86b7292c4a
commit 2fdbdfc087
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
6 changed files with 8 additions and 30 deletions

View File

@ -2304,7 +2304,7 @@ function ChainOptions(options) {
this.bufferKeys = !util.isBrowser; this.bufferKeys = !util.isBrowser;
this.spv = false; this.spv = false;
this.witness = this.network.witness; this.witness = true;
this.prune = false; this.prune = false;
this.indexTX = false; this.indexTX = false;
this.indexAddress = false; this.indexAddress = false;
@ -2327,10 +2327,8 @@ function ChainOptions(options) {
*/ */
ChainOptions.prototype.fromOptions = function fromOptions(options) { ChainOptions.prototype.fromOptions = function fromOptions(options) {
if (options.network != null) { if (options.network != null)
this.network = Network.get(options.network); this.network = Network.get(options.network);
this.witness = this.network.witness;
}
if (options.logger != null) { if (options.logger != null) {
assert(typeof options.logger === 'object'); assert(typeof options.logger === 'object');

View File

@ -2159,7 +2159,7 @@ function PeerOptions(options) {
this.noRelay = false; this.noRelay = false;
this.spv = false; this.spv = false;
this.compact = false; this.compact = false;
this.witness = this.network.witness; this.witness = true;
this.headers = false; this.headers = false;
this.banScore = common.BAN_SCORE; this.banScore = common.BAN_SCORE;
@ -2183,10 +2183,8 @@ function PeerOptions(options) {
PeerOptions.prototype.fromOptions = function fromOptions(options) { PeerOptions.prototype.fromOptions = function fromOptions(options) {
assert(options, 'Options are required.'); assert(options, 'Options are required.');
if (options.network != null) { if (options.network != null)
this.network = Network.get(options.network); this.network = Network.get(options.network);
this.witness = this.network.witness;
}
if (options.logger != null) { if (options.logger != null) {
assert(typeof options.logger === 'object'); assert(typeof options.logger === 'object');

View File

@ -3163,7 +3163,7 @@ function PoolOptions(options) {
this.nonces = new NonceList(); this.nonces = new NonceList();
this.address = new NetAddress(); this.address = new NetAddress();
this.witness = this.network.witness; this.witness = true;
this.useCheckpoints = false; this.useCheckpoints = false;
this.spv = false; this.spv = false;
this.listen = false; this.listen = false;

View File

@ -39,7 +39,6 @@ function Network(options) {
this.pow = options.pow; this.pow = options.pow;
this.block = options.block; this.block = options.block;
this.bip30 = options.bip30; this.bip30 = options.bip30;
this.witness = options.witness;
this.activationThreshold = options.activationThreshold; this.activationThreshold = options.activationThreshold;
this.minerWindow = options.minerWindow; this.minerWindow = options.minerWindow;
this.deployments = options.deployments; this.deployments = options.deployments;

View File

@ -180,7 +180,7 @@ main.pow = {
*/ */
chainwork: new BN( chainwork: new BN(
'0000000000000000000000000000000000000000002cb971dd56d1c583c20f90', '0000000000000000000000000000000000000000003a315fa3a5ef47f4384cf2',
'hex' 'hex'
), ),
@ -309,14 +309,6 @@ main.bip30 = {
91880: '21d77ccb4c08386a04ac0196ae10f6a1d2c2a377558ca190f143070000000000' 91880: '21d77ccb4c08386a04ac0196ae10f6a1d2c2a377558ca190f143070000000000'
}; };
/**
* Whether this is a segwit-enabled network.
* @const {Boolean}
* @default
*/
main.witness = true;
/** /**
* For versionbits. * For versionbits.
* @const {Number} * @const {Number}
@ -548,7 +540,7 @@ testnet.pow = {
), ),
bits: 486604799, bits: 486604799,
chainwork: new BN( chainwork: new BN(
'0000000000000000000000000000000000000000000000198b4def2baa9338d6', '00000000000000000000000000000000000000000000001e345893fa639796e9',
'hex' 'hex'
), ),
targetTimespan: 14 * 24 * 60 * 60, // two weeks targetTimespan: 14 * 24 * 60 * 60, // two weeks
@ -573,8 +565,6 @@ testnet.block = {
testnet.bip30 = {}; testnet.bip30 = {};
testnet.witness = true;
testnet.activationThreshold = 1512; // 75% for testchains testnet.activationThreshold = 1512; // 75% for testchains
testnet.minerWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing testnet.minerWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
@ -724,8 +714,6 @@ regtest.block = {
regtest.bip30 = {}; regtest.bip30 = {};
regtest.witness = false;
regtest.activationThreshold = 108; // 75% for testchains regtest.activationThreshold = 108; // 75% for testchains
regtest.minerWindow = 144; // Faster than normal for regtest (144 instead of 2016) regtest.minerWindow = 144; // Faster than normal for regtest (144 instead of 2016)
@ -876,8 +864,6 @@ segnet4.block = {
segnet4.bip30 = {}; segnet4.bip30 = {};
segnet4.witness = true;
segnet4.activationThreshold = 108; segnet4.activationThreshold = 108;
segnet4.minerWindow = 144; segnet4.minerWindow = 144;
@ -1020,8 +1006,6 @@ simnet.block = {
simnet.bip30 = {}; simnet.bip30 = {};
simnet.witness = true;
simnet.activationThreshold = 1512; // 75% for testchains simnet.activationThreshold = 1512; // 75% for testchains
simnet.minerWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing simnet.minerWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing

View File

@ -242,8 +242,7 @@ function defaultOptions() {
if (options.spv) if (options.spv)
flags |= 1 << 0; flags |= 1 << 0;
if (options.witness || options.network.witness) flags |= 1 << 1;
flags |= 1 << 1;
if (options.prune) if (options.prune)
flags |= 1 << 2; flags |= 1 << 2;