fix p2p connecting
This commit is contained in:
parent
ae8f50793f
commit
ba8a0e83d2
6 changed files with 46 additions and 15 deletions
|
|
@ -310,6 +310,22 @@ Wallet.prototype.getAddressesStr = function(onlyMain) {
|
|||
return ret;
|
||||
};
|
||||
|
||||
|
||||
Wallet.prototype.addressIsOwn = function(addrStr) {
|
||||
var addrList = this.getAddressesStr();
|
||||
var l = addrList.length;
|
||||
var ret = false;
|
||||
|
||||
for(var i=0; i<l; i++) {
|
||||
if (addrList[i] === addrStr) {
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
Wallet.prototype.getTotalBalance = function(cb) {
|
||||
this.getBalance(this.getAddressesStr(), function(balance) {
|
||||
return cb(balance);
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ WalletFactory.prototype._checkRead = function(walletId) {
|
|||
s.get(walletId, 'opts') &&
|
||||
s.get(walletId, 'privateKey')
|
||||
;
|
||||
return ret;
|
||||
return ret?true:false;
|
||||
};
|
||||
|
||||
WalletFactory.prototype.read = function(walletId) {
|
||||
if (! this._checkRead(walletId))
|
||||
throw Error('Check read failed');
|
||||
return false;
|
||||
|
||||
var s = this.storage;
|
||||
var opts = s.get(walletId, 'opts');
|
||||
|
|
@ -175,7 +175,7 @@ WalletFactory.prototype.connectTo = function(peerId, cb) {
|
|||
self.network.start(function() {
|
||||
self.network.connectTo(peerId)
|
||||
self.network.on('walletId', function(walletId) {
|
||||
console.log('[WalletFactory.js.187]'); //TODO
|
||||
self.log('Opening walletId:' + walletId);
|
||||
return cb(self.open(walletId));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue