fix insufficient funds error msg & tests
This commit is contained in:
parent
8e7fa61466
commit
fdd3b831c0
|
@ -427,8 +427,9 @@ CopayServer.prototype.createTx = function(opts, cb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
txp.inputs = self._selectUtxos(txp, utxos);
|
txp.inputs = self._selectUtxos(txp, utxos);
|
||||||
if (!txp.inputs)
|
if (!txp.inputs) {
|
||||||
return cb('insufficient funds')
|
return cb(new CopayError('INSUFFICIENTFUNDS', 'Insufficient funds'));
|
||||||
|
}
|
||||||
|
|
||||||
// no need to do this now: // TODO remove this comment
|
// no need to do this now: // TODO remove this comment
|
||||||
//self._createRawTx(txp);
|
//self._createRawTx(txp);
|
||||||
|
|
|
@ -778,7 +778,8 @@ describe('Copay server', function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
server.createTx(txOpts, function(err, tx) {
|
server.createTx(txOpts, function(err, tx) {
|
||||||
err.should.contain('insufficient');
|
err.code.should.equal('INSUFFICIENTFUNDS');
|
||||||
|
err.message.should.equal('Insufficient funds');
|
||||||
server.getPendingTxs({
|
server.getPendingTxs({
|
||||||
walletId: '123'
|
walletId: '123'
|
||||||
}, function(err, txs) {
|
}, function(err, txs) {
|
||||||
|
@ -879,7 +880,8 @@ describe('Copay server', function() {
|
||||||
requestSignature: 'dummy',
|
requestSignature: 'dummy',
|
||||||
};
|
};
|
||||||
server.createTx(txOpts2, function(err, tx) {
|
server.createTx(txOpts2, function(err, tx) {
|
||||||
err.should.contain('insufficient');
|
err.code.should.equal('INSUFFICIENTFUNDS');
|
||||||
|
err.message.should.equal('Insufficient funds');
|
||||||
should.not.exist(tx);
|
should.not.exist(tx);
|
||||||
server.getPendingTxs({
|
server.getPendingTxs({
|
||||||
walletId: '123'
|
walletId: '123'
|
||||||
|
|
Loading…
Reference in New Issue