node: witness option. announce services properly.

This commit is contained in:
Christopher Jeffrey 2016-07-25 00:01:56 -07:00
parent cd4bcb48e8
commit cdbe6fc940
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
6 changed files with 13 additions and 4 deletions

View File

@ -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.');

View File

@ -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
});

View File

@ -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,

View File

@ -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
});

View File

@ -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
});

View File

@ -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;