Skip to content

Commit

Permalink
WEN fixes and improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
killerstorm committed Apr 18, 2015
1 parent a031914 commit ac1ce8e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/wallet/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function Wallet(opts) {
self.aManager.on('newAddress', function (address) { self.emit('newAddress', address) })
self.adManager.on('newAsset', function (assetdef) { self.emit('newAsset', assetdef) })

forwardSyncAndErrors(self.blockchain)
forwardSyncAndErrors(self.walletEventNotifier)

forwardSyncAndErrors(self.walletStateManager)
Expand Down
7 changes: 4 additions & 3 deletions lib/wallet/WalletEventNotifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ WalletEventNotifier.prototype._addEventListeners = function () {
// sync once blockchain is synced
var notifyNeedsSync = function () {
if (self._wallet.getBlockchain().isSyncing()) {
self._syncEnter()
self._wallet.getBlockchain().once('syncStop', function () {
if (self._connected) self._notifyNeedsSync()
self._syncExit()
})
} else {
self._notifyNeedsSync()
Expand All @@ -119,7 +121,6 @@ WalletEventNotifier.prototype._addEventListeners = function () {

self._wallet.once('initialize', function () {
if (self._wallet.getConnector().isConnected()) {
console.log('is connected: ' + self._wallet.getConnector().isConnected())
subscribeAllAndSync()
}
})
Expand All @@ -134,11 +135,11 @@ WalletEventNotifier.prototype._addEventListeners = function () {
})

self._wallet.getBlockchain().on('touchAddress', function () {
if (self._wallet.isInitialized()) { notifyNeedsSync() }
if (self._wallet.getConnector().isConnected() && self._wallet.isInitialized()) { notifyNeedsSync() }
})

self._wallet.getAddressManager().on('newAddress', function (address) {
if (self._wallet.isInitialized()) {
if (self._wallet.getConnector().isConnected() && self._wallet.isInitialized()) {
subscribeAddressAndSync(address.getAddress())
}
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"bs58": "2.0.1",
"lodash": "2.4.1",
"errno": "0.1.1",
"blockchainjs": "git://github.com/chromaway/blockchainjs#v0.3.0",
"blockchainjs": "git://github.com/chromaway/blockchainjs#v0.3.1",
"q": "1.1.2",
"buffer-equal": "0.0.1",
"coloredcoinjs-lib": "git://github.com/chromaway/coloredcoinjs-lib#v0.3.5"
Expand Down

0 comments on commit ac1ce8e

Please sign in to comment.