off by one error

This commit is contained in:
Alexandre Van de Sande 2016-02-23 08:40:27 -03:00
parent 2682af7bd6
commit d95b10a57a
1 changed files with 2 additions and 2 deletions

View File

@ -425,7 +425,7 @@ var isChecksumAddress = function (address) {
for (var i = 0; i < 40; i++ ) {
// the nth letter should be uppercase if the nth digit of casemap is 1
if ((parseInt(addressHash[i], 16) > 8 && address[i].toUpperCase() != address[i]) || (parseInt(addressHash[i], 16) <= 8 && address[i].toLowerCase() != address[i])) {
if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() != address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() != address[i])) {
return false;
}
}
@ -448,7 +448,7 @@ var toChecksumAddress = function (address) {
for (var i = 0; i < address.length; i++ ) {
// If ith character is 9 to f then make it uppercase
if (parseInt(addressHash[i], 16) > 8) {
if (parseInt(addressHash[i], 16) > 7) {
checksumAddress += address[i].toUpperCase();
} else {
checksumAddress += address[i];