update to master
This commit is contained in:
parent
d8b10f6629
commit
4fe58ec446
5 changed files with 54 additions and 42 deletions
|
|
@ -89,9 +89,9 @@ Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
|
|||
var wasIncomplete = !this.publicKeyRing.isComplete();
|
||||
var hasChanged;
|
||||
|
||||
try{
|
||||
try {
|
||||
hasChanged = this.publicKeyRing.merge(inPKR, true);
|
||||
} catch (e){
|
||||
} catch (e) {
|
||||
this.log('## WALLET ERROR', e); //TODO
|
||||
this.emit('connectionError', e.message);
|
||||
return;
|
||||
|
|
@ -140,7 +140,7 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
|
|||
Wallet.prototype._handleData = function(senderId, data, isInbound) {
|
||||
|
||||
// TODO check message signature
|
||||
|
||||
|
||||
if (data.type !== 'walletId' && this.id !== data.walletId) {
|
||||
this.emit('badMessage', senderId);
|
||||
this.log('badMessage FROM:', senderId); //TODO
|
||||
|
|
@ -281,7 +281,7 @@ Wallet.prototype.scheduleConnect = function() {
|
|||
var self = this;
|
||||
if (self.network.isOnline()) {
|
||||
self.connectToAll();
|
||||
self.currentDelay = self.currentDelay*2 || self.reconnectDelay;
|
||||
self.currentDelay = self.currentDelay * 2 || self.reconnectDelay;
|
||||
setTimeout(self.scheduleConnect.bind(self), self.currentDelay);
|
||||
}
|
||||
}
|
||||
|
|
@ -329,7 +329,7 @@ Wallet.prototype.toObj = function() {
|
|||
opts: optsObj,
|
||||
publicKeyRing: this.publicKeyRing.toObj(),
|
||||
txProposals: this.txProposals.toObj(),
|
||||
privateKey: this.privateKey?this.privateKey.toObj():undefined
|
||||
privateKey: this.privateKey ? this.privateKey.toObj() : undefined
|
||||
};
|
||||
|
||||
return walletObj;
|
||||
|
|
@ -454,7 +454,7 @@ Wallet.prototype.reject = function(ntxid) {
|
|||
var myId = this.getMyCopayerId();
|
||||
var txp = this.txProposals.txps[ntxid];
|
||||
if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) {
|
||||
throw new Error('Invalid transaction to reject: '+ntxid);
|
||||
throw new Error('Invalid transaction to reject: ' + ntxid);
|
||||
}
|
||||
|
||||
txp.rejectedBy[myId] = Date.now();
|
||||
|
|
@ -569,6 +569,9 @@ Wallet.prototype.getBalance = function(cb) {
|
|||
var BIT = coinUtil.BIT;
|
||||
var COIN = coinUtil.COIN;
|
||||
|
||||
if (!BIT)
|
||||
throw new Error('BIT not defined. A newer version of bitcore is needed');
|
||||
|
||||
this.getUnspent(function(err, safeUnspent, unspent) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
|
|
@ -593,7 +596,7 @@ Wallet.prototype.getBalance = function(cb) {
|
|||
safeBalance += amt;
|
||||
}
|
||||
|
||||
safeBalance = safeBalance.toFixed(0) /BIT ;
|
||||
safeBalance = safeBalance.toFixed(0) / BIT;
|
||||
return cb(null, balance, balanceByAddr, safeBalance);
|
||||
});
|
||||
};
|
||||
|
|
@ -611,8 +614,8 @@ Wallet.prototype.getUnspent = function(cb) {
|
|||
var uu = self.txProposals.getUsedUnspent(maxRejectCount);
|
||||
|
||||
for (var i in unspentList) {
|
||||
var u=unspentList[i];
|
||||
if (! uu[u.txid +','+u.vout])
|
||||
var u = unspentList[i];
|
||||
if (!uu[u.txid + ',' + u.vout])
|
||||
safeUnspendList.push(u);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue