Refactor controllers
This commit is contained in:
parent
33801e9587
commit
16091bd330
9 changed files with 50 additions and 47 deletions
|
|
@ -50,7 +50,7 @@ var Insight = function (opts) {
|
|||
var self = this;
|
||||
this.socket.on('connect', function() {
|
||||
self.status = self.STATUS.CONNECTED;
|
||||
self.suscribeToBlocks();
|
||||
self.subscribeToBlocks();
|
||||
self.emit('connect', 0);
|
||||
});
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ Insight.prototype.STATUS = {
|
|||
}
|
||||
|
||||
/** @private */
|
||||
Insight.prototype.suscribeToBlocks = function() {
|
||||
Insight.prototype.subscribeToBlocks = function() {
|
||||
if (this.listeningBlocks || !this.socket.connected) return;
|
||||
|
||||
var self = this;
|
||||
|
|
@ -132,9 +132,12 @@ Insight.prototype.subscribe = function(addresses) {
|
|||
addresses.forEach(function(address) {
|
||||
preconditions.checkArgument(new bitcore.Address(address).isValid());
|
||||
|
||||
self.subscribed.push(address);
|
||||
self.socket.emit('subscribe', address);
|
||||
self.socket.on(address, handlerFor(self, address));
|
||||
// skip already subscibed
|
||||
if (self.subscribed.indexOf(address) == -1) {
|
||||
self.subscribed.push(address);
|
||||
self.socket.emit('subscribe', address);
|
||||
self.socket.on(address, handlerFor(self, address));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -805,8 +805,6 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
|
|||
|
||||
var self = this;
|
||||
this.blockchain.broadcast(txHex, function(err, txid) {
|
||||
if(err) throw err;
|
||||
|
||||
self.log('BITCOIND txid:', txid);
|
||||
if (txid) {
|
||||
self.txProposals.get(ntxid).setSent(txid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue