txdb: remove updated event.

This commit is contained in:
Christopher Jeffrey 2016-08-12 02:20:46 -07:00
parent 63c9c81831
commit e50cbc911c
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 7 additions and 22 deletions

View File

@ -980,12 +980,6 @@ HTTPServer.prototype._initIO = function _initIO() {
self.server.io.to('!all').emit('wallet confirmed', id, details);
});
this.walletdb.on('updated', function(id, tx, details) {
details = details.toJSON();
self.server.io.to(id).emit('wallet updated', details);
self.server.io.to('!all').emit('wallet updated', id, details);
});
this.walletdb.on('balance', function(id, balance, details) {
balance = {
confirmed: utils.btc(balance.confirmed),

View File

@ -668,7 +668,6 @@ TXDB.prototype._resolveOrphans = function _resolveOrphans(tx, index, callback) {
TXDB.prototype._add = function add(tx, info, callback) {
var self = this;
var updated = false;
var batch, hash, i, j, path, paths, id;
if (tx.mutable)
@ -738,8 +737,6 @@ TXDB.prototype._add = function add(tx, info, callback) {
return self._addOrphan(key, outpoint, next);
}
updated = true;
for (j = 0; j < paths.length; j++) {
path = paths[j];
id = path.id + '/' + path.account;
@ -794,8 +791,6 @@ TXDB.prototype._add = function add(tx, info, callback) {
self.coinCache.set(key, coin);
updated = true;
next();
});
}, function(err) {
@ -814,12 +809,8 @@ TXDB.prototype._add = function add(tx, info, callback) {
self.emit('tx', tx, info);
if (updated) {
if (tx.ts !== 0)
self.emit('confirmed', tx, info);
self.emit('updated', tx, info);
}
if (tx.ts !== 0)
self.emit('confirmed', tx, info);
return callback(null, true, info);
});
@ -1009,7 +1000,11 @@ TXDB.prototype._confirm = function _confirm(tx, info, callback) {
// and remove pending flag to mark as confirmed.
assert(tx.height >= 0);
// Save the original received time.
tx.ps = existing.ps;
batch = self.start();
batch.put('t/' + hash, tx.toExtended());
batch.del('p/' + hash);
@ -1053,8 +1048,8 @@ TXDB.prototype._confirm = function _confirm(tx, info, callback) {
return callback(err);
}
self.emit('confirmed', tx, info);
self.emit('tx', tx, info);
self.emit('confirmed', tx, info);
self.commit(function(err) {
if (err)

View File

@ -127,10 +127,6 @@ WalletDB.prototype._init = function _init() {
this.tx.on('unconfirmed', function(tx, info) {
handleEvent('unconfirmed', tx, info);
});
this.tx.on('updated', function(tx, info) {
handleEvent('updated', tx, info);
});
};
/**