diff --git a/browser/index.js b/browser/index.js
index 303ded75..9e1b6b0c 100644
--- a/browser/index.js
+++ b/browser/index.js
@@ -161,17 +161,17 @@ function setMouseup(el, obj) {
function formatWallet(wallet) {
var html = '';
- var key = wallet.master.toJSON().key;
+ var key = wallet.master.toJSON(true).key;
var i, tx, el;
html += 'Wallet
';
- if (bcoin.network.primary.witness) {
+ if (wallet.account.witness) {
html += 'Current Address (p2wpkh): '
+ wallet.getAddress()
+ '
';
html += 'Current Address (p2wpkh behind p2sh): '
- + wallet.getProgramAddress()
+ + wallet.getNestedAddress()
+ '
';
} else {
html += 'Current Address: ' + wallet.getAddress() + '
';
@@ -189,8 +189,6 @@ function formatWallet(wallet) {
+ utils.btc(balance.unconfirmed)
+ '
';
- html += 'Balance: ' + utils.btc(balance.total) + '
';
-
return wallet.getHistory();
}).then(function(txs) {
return wallet.toDetails(txs);
diff --git a/browser/wsproxy.js b/browser/wsproxy.js
index e54d7b81..cbb8a098 100644
--- a/browser/wsproxy.js
+++ b/browser/wsproxy.js
@@ -107,21 +107,30 @@ WSProxy.prototype._handleConnect = function _handleConnect(ws, port, host, nonce
if (!/^[a-zA-Z0-9\.:\-]+$/.test(host)) {
this.log('Client gave a bad host (%s).', state.host);
- ws.emit('tcp close');
+ ws.emit('tcp error', {
+ message: 'EHOSTUNREACH',
+ code: 'EHOSTUNREACH'
+ });
ws.disconnect();
return;
}
if (IP.isPrivate(host)) {
this.log('Client is trying to connect to a private ip (%s).', state.host);
- ws.emit('tcp close');
+ ws.emit('tcp error', {
+ message: 'ENETUNREACH',
+ code: 'ENETUNREACH'
+ });
ws.disconnect();
return;
}
if (this.ports.indexOf(port) === -1) {
this.log('Client is connecting to non-whitelist port (%s).', state.host);
- ws.emit('tcp close');
+ ws.emit('tcp error', {
+ message: 'ENETUNREACH',
+ code: 'ENETUNREACH'
+ });
ws.disconnect();
return;
}
@@ -132,7 +141,10 @@ WSProxy.prototype._handleConnect = function _handleConnect(ws, port, host, nonce
} catch (e) {
this.log(e.message);
this.log('Closing %s (%s).', state.remoteHost, state.host);
- ws.emit('tcp close');
+ ws.emit('tcp error', {
+ message: 'ENETUNREACH',
+ code: 'ENETUNREACH'
+ });
ws.disconnect();
return;
}