in isValidAddress check that address starting with 'r'

because UInt160 considers valid hex values
This commit is contained in:
Ivan Tivonenko
2015-08-19 04:57:27 +03:00
parent 2515d17a85
commit 0e97f269ab
2 changed files with 10 additions and 1 deletions

View File

@@ -12,7 +12,9 @@ const ValidationError = require('./errors').ValidationError;
let SCHEMAS = {};
function isValidAddress(address: string): boolean {
return core.UInt160.is_valid(address);
return typeof address === 'string' && address.length > 0 &&
address[0] === 'r' &&
core.UInt160.is_valid(address);
}
function isValidLedgerHash(ledgerHash) {