fail early with invalid tx proposals

This commit is contained in:
Manuel Araoz 2014-06-04 16:28:37 -03:00
parent 660462ddce
commit cd23751ada
1 changed files with 4 additions and 2 deletions

View File

@ -438,7 +438,9 @@ Wallet.prototype.getTxProposals = function() {
Wallet.prototype.reject = function(ntxid) {
var myId = this.getMyCopayerId();
var txp = this.txProposals.txps[ntxid];
if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) return;
if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) {
throw new Error('Invalid transaction to reject: '+ntxid);
}
txp.rejectedBy[myId] = Date.now();
this.sendTxProposals(null, ntxid);
@ -454,7 +456,7 @@ Wallet.prototype.sign = function(ntxid, cb) {
var txp = self.txProposals.txps[ntxid];
if (!txp || txp.rejectedBy[myId] || txp.signedBy[myId]) {
if (cb) cb(false);
return;
throw new Error('Invalid transaction to sign: '+ntxid);
}
var pkr = self.publicKeyRing;