Merge pull request #1307 from stellitecoin/master

Add Stellite Coin
This commit is contained in:
Manfred Karrer 2018-02-02 20:11:12 -05:00 committed by GitHub
commit 53ec4b2404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -146,7 +146,8 @@ public class CurrencyUtil {
result.add(new CryptoCurrency("SIB", "Sibcoin"));
result.add(new CryptoCurrency("XSPEC", "Spectrecoin"));
result.add(new CryptoCurrency("STEEM", "STEEM"));
result.add(new CryptoCurrency("TRC", "Terracoin"));
result.add(new CryptoCurrency("STL", "Stellite"));
result.add(new CryptoCurrency("TRC", "Terracoin"));
result.add(new CryptoCurrency("MVT", "The Movement", true));
result.add(new CryptoCurrency("UNO", "Unobtanium"));

View File

@ -433,7 +433,11 @@ public final class AltCoinAddressValidator extends InputValidator {
return regexTestFailed;
else
return new ValidationResult(true);
case "STL":
if(!input.matches("^(Se)\\d[0-9A-Za-z]{94}$"))
return regexTestFailed;
else
return new ValidationResult(true);
// Add new coins at the end...
default:

View File

@ -568,4 +568,18 @@ public class AltCoinAddressValidatorTest {
assertFalse(validator.validate("2a65Aca4D5fC5B5C859090a6c34d16413539822g").isValid);
assertFalse(validator.validate("").isValid);
}
@Test
public void testSTL() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("STL");
assertTrue(validator.validate("Se3x7sVdvUnMMn2KoYLyYVHMJGRoB2R3V8K3LYuHAiEXgVac7vsmFiXUC8dSpJnjXDfwytKsQJV6HFH8MjwPagTJ2Aha46RZM").isValid);
assertTrue(validator.validate("Se3F51UzpbVVnQRx2VNbcjfBoQJfeuyFF353i1jLnCZda9yVN3vy8csbYCESBvf38TFkchH1C1tMY6XHkC8L678K2vLsVZVMU").isValid);
assertFalse(validator.validate("Se3x7svUnMMn2KoYLyYVHMJGRoB2R3V8K3LYuHAiEXgVac7vsmFiXUC8dSpJnjXDfwytKsQJV6HFH8MjwPagTJ2Aha46RZM").isValid); //Only 95 charecter, expected is 97.
assertFalse(validator.validate("SX45GjRnvqheAgCpx4nJeKRjDtS5tYawxEP1GaTj79dTEm21Dtdxex6EHyDqBpofoDqW9k9uQWtkGgbbF8kiRSZ27AksBg7G111").isValid); //Address prefix is Se and not SX and not 99 chars.
assertFalse(validator.validate("Se3F51UzpbVVnQRx2VNbcjfBoQJfeuyFF353i1jLnCZda9yVN3vy8csbYCESBvf38TFkchH1C1tMY6XHkC8L678K2vLsVZVMUII").isValid); //99 Charecters, expected is 97
assertFalse(validator.validate("").isValid);
}
}