new error for address network mismatch
This commit is contained in:
parent
e1fac88a8e
commit
90dfc17ab5
|
@ -11,6 +11,7 @@ var errors = {
|
||||||
COPAYER_REGISTERED: 'Copayer ID already registered on server',
|
COPAYER_REGISTERED: 'Copayer ID already registered on server',
|
||||||
COPAYER_VOTED: 'Copayer already voted on this transaction proposal',
|
COPAYER_VOTED: 'Copayer already voted on this transaction proposal',
|
||||||
DUST_AMOUNT: 'Amount below dust threshold',
|
DUST_AMOUNT: 'Amount below dust threshold',
|
||||||
|
INCORRECT_ADDRESS_NETWORK: 'Incorrect address network',
|
||||||
INSUFFICIENT_FUNDS: 'Insufficient funds',
|
INSUFFICIENT_FUNDS: 'Insufficient funds',
|
||||||
INSUFFICIENT_FUNDS_FOR_FEE: 'Insufficient funds for fee',
|
INSUFFICIENT_FUNDS_FOR_FEE: 'Insufficient funds for fee',
|
||||||
INVALID_ADDRESS: 'Invalid address',
|
INVALID_ADDRESS: 'Invalid address',
|
||||||
|
|
|
@ -1009,11 +1009,11 @@ WalletService.prototype.createTx = function(opts, cb) {
|
||||||
try {
|
try {
|
||||||
toAddress = new Bitcore.Address(output.toAddress);
|
toAddress = new Bitcore.Address(output.toAddress);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
cb(new ClientError(Errors.codes.INVALID_ADDRESS, 'Invalid address'));
|
cb(Errors.INVALID_ADDRESS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (toAddress.network != wallet.getNetworkName()) {
|
if (toAddress.network != wallet.getNetworkName()) {
|
||||||
cb(new ClientError(Errors.codes.INVALID_ADDRESS, 'Incorrect address network'));
|
cb(Errors.INCORRECT_ADDRESS_NETWORK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!_.isNumber(output.amount) || _.isNaN(output.amount) || output.amount <= 0) {
|
if (!_.isNumber(output.amount) || _.isNaN(output.amount) || output.amount <= 0) {
|
||||||
|
|
|
@ -1779,7 +1779,7 @@ describe('Wallet service', function() {
|
||||||
server.createTx(txOpts, function(err, tx) {
|
server.createTx(txOpts, function(err, tx) {
|
||||||
should.not.exist(tx);
|
should.not.exist(tx);
|
||||||
should.exist(err);
|
should.exist(err);
|
||||||
err.code.should.equal('INVALID_ADDRESS');
|
err.code.should.equal('INCORRECT_ADDRESS_NETWORK');
|
||||||
err.message.should.equal('Incorrect address network');
|
err.message.should.equal('Incorrect address network');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue