|
|
@ -482,6 +482,39 @@ CopayServer.prototype.removeWallet = function(opts, cb) { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* removePendingTx |
|
|
|
* |
|
|
|
* @param opts |
|
|
|
* @param {string} opts.id - The tx id. |
|
|
|
* @return {undefined} |
|
|
|
*/ |
|
|
|
CopayServer.prototype.removePendingTx = function(opts, cb) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['id'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
Utils.runLocked(self.id, cb, function(cb) { |
|
|
|
|
|
|
|
self.storage.fetchTx(self.walletId, opts.id, function(err, txp) { |
|
|
|
if (err) return cb(err); |
|
|
|
if (!txp) |
|
|
|
return cb(new ClientError('Transaction proposal not found')); |
|
|
|
|
|
|
|
if (!txp.isPending()) |
|
|
|
return cb(new ClientError('Transaction proposal not pending')); |
|
|
|
|
|
|
|
var actors = txp.getActors(); |
|
|
|
|
|
|
|
if (actors.length > 1 || actors[0] !== self.copayerId) |
|
|
|
return cb(new ClientError('No allowed to erase this TX')); |
|
|
|
|
|
|
|
self.storage.removeTx(opts.id, cb); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
CopayServer.prototype._broadcastTx = function(txp, cb) { |
|
|
|
var raw = txp.getRawTx(); |
|
|
@ -510,8 +543,9 @@ CopayServer.prototype.signTx = function(opts, cb) { |
|
|
|
}, function(err, txp) { |
|
|
|
if (err) return cb(err); |
|
|
|
if (!txp) return cb(new ClientError('Transaction proposal not found')); |
|
|
|
|
|
|
|
var action = _.find(txp.actions, { |
|
|
|
copayerId: opts.copayerId |
|
|
|
copayerId: self.copayerId |
|
|
|
}); |
|
|
|
if (action) |
|
|
|
return cb(new ClientError('CVOTED', 'Copayer already voted on this transaction proposal')); |
|
|
|