diff --git a/lib/bcoin/chain.js b/lib/bcoin/chain.js index c4df2e23..4b84274b 100644 --- a/lib/bcoin/chain.js +++ b/lib/bcoin/chain.js @@ -701,7 +701,7 @@ Chain.prototype.getDeployments = function getDeployments(block, prev, ancestors, if (err) return next(err); - if (active && self.network.witness) { + if (active && self.options.witness) { state.flags |= constants.flags.VERIFY_WITNESS; if (!self.state.hasWitness()) self.logger.warning('Segwit has been activated.'); diff --git a/lib/bcoin/fullnode.js b/lib/bcoin/fullnode.js index b65c38cd..e763099b 100644 --- a/lib/bcoin/fullnode.js +++ b/lib/bcoin/fullnode.js @@ -61,6 +61,7 @@ function Fullnode(options) { location: this.location('chain'), preload: false, spv: false, + witness: this.network.witness, prune: this.options.prune, useCheckpoints: this.options.useCheckpoints, coinCache: this.options.coinCache @@ -121,6 +122,7 @@ function Fullnode(options) { fees: this.fees, db: this.db, location: this.location('walletdb'), + witness: this.network.witness, useCheckpoints: this.options.useCheckpoints, verify: false }); diff --git a/lib/bcoin/peer.js b/lib/bcoin/peer.js index 3d76447f..9e799c9c 100644 --- a/lib/bcoin/peer.js +++ b/lib/bcoin/peer.js @@ -479,7 +479,7 @@ Peer.prototype.sendHeaders = function sendHeaders(items) { Peer.prototype.sendVersion = function sendVersion() { var packet = new VersionPacket({ version: constants.VERSION, - services: constants.LOCAL_SERVICES, + services: this.pool.services, ts: bcoin.now(), recv: new NetworkAddress(), from: this.pool.address, diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index dccd842c..86bc006d 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -122,9 +122,14 @@ function Pool(options) { this.seeds.push(seed); } + this.services = constants.LOCAL_SERVICES; + + if (!this.options.witness) + this.services &= ~constants.services.WITNESS; + this.address = new NetworkAddress({ ts: utils.now() - (process.uptime() | 0), - services: constants.LOCAL_SERVICES, + services: this.services, host: '0.0.0.0', port: this.network.port }); diff --git a/lib/bcoin/spvnode.js b/lib/bcoin/spvnode.js index b80097b0..0192a4c6 100644 --- a/lib/bcoin/spvnode.js +++ b/lib/bcoin/spvnode.js @@ -46,6 +46,7 @@ function SPVNode(options) { profiler: this.profiler, db: this.db, location: this.location('spvchain'), + witness: this.network.witness, preload: this.options.preload, useCheckpoints: this.options.useCheckpoints, spv: true @@ -68,6 +69,7 @@ function SPVNode(options) { logger: this.logger, db: this.db, location: this.location('walletdb'), + witness: this.network.witness, verify: true }); diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index f7e874f2..ffbd810c 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -1769,7 +1769,7 @@ function Account(db, options) { this.id = null; this.name = null; - this.witness = this.network.witness; + this.witness = this.db.options.witness; this.accountKey = null; this.accountIndex = 0; this.receiveDepth = 0;