|
@ -496,25 +496,22 @@ CopayServer.prototype.removePendingTx = function(opts, cb) { |
|
|
|
|
|
|
|
|
Utils.runLocked(self.walletId, cb, function(cb) { |
|
|
Utils.runLocked(self.walletId, cb, function(cb) { |
|
|
|
|
|
|
|
|
self.storage.fetchTx(self.walletId, opts.id, function(err, txp) { |
|
|
self.getTx({ |
|
|
|
|
|
id: opts.id |
|
|
|
|
|
}, function(err, txp) { |
|
|
if (err) return cb(err); |
|
|
if (err) return cb(err); |
|
|
if (!txp) |
|
|
|
|
|
return cb(new ClientError('Transaction proposal not found')); |
|
|
|
|
|
|
|
|
|
|
|
if (!txp.isPending()) |
|
|
if (!txp.isPending()) |
|
|
return cb(new ClientError('Transaction proposal not pending')); |
|
|
return cb(new ClientError('Transaction proposal not pending')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (txp.creatorId !== self.copayerId) |
|
|
if (txp.creatorId !== self.copayerId) |
|
|
return cb(new ClientError('Not allowed to erase this TX')); |
|
|
return cb(new ClientError('Only creators can remove pending proposals')); |
|
|
|
|
|
|
|
|
var actors = txp.getActors(); |
|
|
var actors = txp.getActors(); |
|
|
|
|
|
|
|
|
if (actors.length > 1) |
|
|
if (actors.length > 1 || (actors.length == 1 && actors[0] !== self.copayerId)) |
|
|
return cb(new ClientError('Not allowed to erase this TX')); |
|
|
return cb(new ClientError('Cannot remove a proposal signed/rejected by other copayers')); |
|
|
|
|
|
|
|
|
if (actors.length == 1 && actors[0] !== self.copayerId) |
|
|
|
|
|
return cb(new ClientError('Not allowed to erase this TX')); |
|
|
|
|
|
|
|
|
|
|
|
self.storage.removeTx(self.walletId, opts.id, cb); |
|
|
self.storage.removeTx(self.walletId, opts.id, cb); |
|
|
}); |
|
|
}); |
|
|