http: better events.
This commit is contained in:
parent
c7ab83993c
commit
3cac0a96d2
@ -1214,15 +1214,8 @@ function ClientSocket(server, socket) {
|
|||||||
this.filter = {};
|
this.filter = {};
|
||||||
this.filterCount = 0;
|
this.filterCount = 0;
|
||||||
|
|
||||||
this.node = this.server.node;
|
|
||||||
this.network = this.server.network;
|
|
||||||
this.chain = this.server.chain;
|
this.chain = this.server.chain;
|
||||||
this.mempool = this.server.mempool;
|
this.mempool = this.server.mempool;
|
||||||
this.pool = this.server.pool;
|
|
||||||
this.fees = this.server.fees;
|
|
||||||
this.miner = this.server.miner;
|
|
||||||
this.wallet = this.server.wallet;
|
|
||||||
this.walletdb = this.server.walletdb;
|
|
||||||
this.logger = this.server.logger;
|
this.logger = this.server.logger;
|
||||||
this.events = [];
|
this.events = [];
|
||||||
|
|
||||||
@ -1248,7 +1241,7 @@ ClientSocket.prototype._init = function _init() {
|
|||||||
else
|
else
|
||||||
ack = self.socket.ack(packet.id);
|
ack = self.socket.ack(packet.id);
|
||||||
|
|
||||||
emit.apply(self, [event, args, ack]);
|
emit.call(self, event, args, ack);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -195,9 +195,10 @@ describe('Chain', function() {
|
|||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
chain.add(block, function(err) {
|
chain.add(block, function(err) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
chain.db.getCoin(block.txs[1].hash('hex'), 1, function(err, coin) {
|
var tx = block.txs[1];
|
||||||
|
var output = bcoin.coin.fromTX(tx, 1);
|
||||||
|
chain.db.getCoin(tx.hash('hex'), 1, function(err, coin) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
var output = bcoin.coin.fromTX(block.txs[1], 1);
|
|
||||||
assert.deepEqual(coin.toRaw(), output.toRaw());
|
assert.deepEqual(coin.toRaw(), output.toRaw());
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
@ -228,15 +229,15 @@ describe('Chain', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should rescan for transactions', function(cb) {
|
it('should rescan for transactions', function(cb) {
|
||||||
var txs = [];
|
var total = 0;
|
||||||
walletdb.getAddressHashes(function(err, hashes) {
|
walletdb.getAddressHashes(function(err, hashes) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
chain.db.scan(null, hashes, function(block, tx, next) {
|
chain.db.scan(null, hashes, function(block, txs, next) {
|
||||||
txs = txs.concat(tx);
|
total += txs.length;
|
||||||
next();
|
next();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.equal(txs.length, 25);
|
assert.equal(total, 25);
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -244,6 +245,6 @@ describe('Chain', function() {
|
|||||||
|
|
||||||
it('should cleanup', function(cb) {
|
it('should cleanup', function(cb) {
|
||||||
constants.tx.COINBASE_MATURITY = 100;
|
constants.tx.COINBASE_MATURITY = 100;
|
||||||
cb();
|
node.close(cb);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user