be more precise on error message
This commit is contained in:
parent
27920e176b
commit
21ac7b0243
|
@ -479,7 +479,7 @@ WalletService.prototype._selectTxInputs = function(txp, cb) {
|
||||||
|
|
||||||
var txMinAmount = txp.amount + Bitcore.Transaction.FEE_PER_KB;
|
var txMinAmount = txp.amount + Bitcore.Transaction.FEE_PER_KB;
|
||||||
if (balance.totalAmount < txMinAmount)
|
if (balance.totalAmount < txMinAmount)
|
||||||
return cb(new ClientError('INSUFFICIENTFUNDS', 'Insufficient funds'));
|
return cb(new ClientError('INSUFFICIENTFUNDS', 'Insufficient funds' + (balance.totalAmount >= txp.amount ? ' for fee' : '')));
|
||||||
|
|
||||||
if ((balance.totalAmount - balance.lockedAmount) < txMinAmount)
|
if ((balance.totalAmount - balance.lockedAmount) < txMinAmount)
|
||||||
return cb(new ClientError('LOCKEDFUNDS', 'Funds are locked by pending transaction proposals'));
|
return cb(new ClientError('LOCKEDFUNDS', 'Funds are locked by pending transaction proposals'));
|
||||||
|
|
|
@ -938,7 +938,7 @@ describe('Copay server', function() {
|
||||||
server.createTx(txOpts, function(err, tx) {
|
server.createTx(txOpts, function(err, tx) {
|
||||||
should.exist(err);
|
should.exist(err);
|
||||||
err.code.should.equal('INSUFFICIENTFUNDS');
|
err.code.should.equal('INSUFFICIENTFUNDS');
|
||||||
err.message.should.equal('Insufficient funds');
|
err.message.should.equal('Insufficient funds for fee');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue