mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Issue 2021 - Asset validation override issues in many coin extensions
- Fix length issue in regular expression of validate() override in main asset coins. PIVX most likely started the 1+{25,34} that was then proliferated through the copies. While it likely should be 1+33, I could only confirm that 35 is too long, so the code is changed to be 1+{24,33} in order to reduce it by the presumed forgotten first character. - Fixup testInvalidAddresses() to better test regex rules in test asset coins. The PIVX base code was testing against 3 addresses, that all had a different first character, therefore none of the rest of the regular expression was being tested. Changed those addresses (and others for other susceptable coins) to accurately test first character match, length, and invalid characters in the 24 to 33 series.
This commit is contained in:
parent
a9a8703de0
commit
2288042080
@ -37,7 +37,7 @@ public class BitCloud extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[B][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[B][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -38,7 +38,7 @@ public class Credits extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[C][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[C][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class Cryptonodes extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[c][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[c][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class DRIP extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class FuturoCoin extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[F][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[F][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class MegaCoin extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[M][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[M][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class MonetaryUnit extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[7][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[7][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class Neos extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[N][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[N][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class NewPowerCoin extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[N][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[N][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class PIVX extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[D][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class PZDC extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[P][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[P][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class QMCoin extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[Q][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[Q][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class SUB1X extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[Z][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[Z][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,7 +37,7 @@ public class Wavi extends Coin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressValidationResult validate(String address) {
|
public AddressValidationResult validate(String address) {
|
||||||
if (!address.matches("^[W][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
|
if (!address.matches("^[W][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
|
||||||
return AddressValidationResult.invalidStructure();
|
return AddressValidationResult.invalidStructure();
|
||||||
|
|
||||||
return super.validate(address);
|
return super.validate(address);
|
||||||
|
@ -37,8 +37,9 @@ public class BitCloudTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
assertInvalidAddress("17dtuCkeYcQQiTdr9wAK7HZtmvvrM24jEH");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
|
assertInvalidAddress("BGp8DmF5wwpaDUsK9Mi3SByTDuvgy6XJGSq");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
|
assertInvalidAddress("BDL6jpyNge8VB8LL8dEDX1bxfZ3jHGYz$3");
|
||||||
|
assertInvalidAddress("BKuvEvMrXmPFPC3YGGHHnZo0VYxeddxAjC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,6 @@ public class CreditsTest extends AbstractAssetTest {
|
|||||||
assertInvalidAddress("1fXBhPhSxx1wqxGQCryfgn6iU1M1XFUuCo32");
|
assertInvalidAddress("1fXBhPhSxx1wqxGQCryfgn6iU1M1XFUuCo32");
|
||||||
assertInvalidAddress("CMde7YERCFWkCL2W5i8uyJmnpCVj8Chh");
|
assertInvalidAddress("CMde7YERCFWkCL2W5i8uyJmnpCVj8Chh");
|
||||||
assertInvalidAddress("CcbqU3MLZuGAED2CuhUkquyJxKaSJqv6V6#");
|
assertInvalidAddress("CcbqU3MLZuGAED2CuhUkquyJxKaSJqv6V6#");
|
||||||
assertInvalidAddress("bKaig5pznaUgiLqe6WkoCNGagNMhNLtqhKkggg");
|
assertInvalidAddress("cKaig5pznaUgiLqe6WkoCNGagNMhNLtqhK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,9 @@ public class CryptonodesTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
assertInvalidAddress("cmqiMdMJuXf3meR3Qxy9hhHS85tuTRMRbub");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
|
assertInvalidAddress("CjMRzBHViq7WGgJUuNdiuks39ZCMjyG7UT");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
|
assertInvalidAddress("cYXaTfAEMrvr3cZEQ30UxKJuzbvBwgTR2e");
|
||||||
|
assertInvalidAddress("cX38diq2mcFpBMEWbTRvyrdbINBjyv2nq9");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,9 @@ public class DRIPTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
assertInvalidAddress("dFJku78A14HYwPSzC5PtUmda7jMr5pbD2B");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
|
assertInvalidAddress("DAeiBSH4nudXgoxS4kY6uhTPobc7ALrWDAe");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
|
assertInvalidAddress("DRbnCYbuMXdKI4y8dya9EnocL47gFjErWe");
|
||||||
|
assertInvalidAddress("DTPAqTryNRCE2FgsxzohTtJXf0BCDnG6Rc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,5 +46,6 @@ public class FuturoCoinTest extends AbstractAssetTest {
|
|||||||
assertInvalidAddress("FheRu8mY47PpUCx4kvjgsRQcLtoG9uDbT9");
|
assertInvalidAddress("FheRu8mY47PpUCx4kvjgsRQcLtoG9uDbT9");
|
||||||
assertInvalidAddress("Fd7gZ7dNJ1toY6TeWy3rf2dUvyRudggTL");
|
assertInvalidAddress("Fd7gZ7dNJ1toY6TeWy3rf2dUvyRudggTL");
|
||||||
assertInvalidAddress("FbRXmJUDgf5URuVGyM223P8R2JArXSSm61");
|
assertInvalidAddress("FbRXmJUDgf5URuVGyM223P8R2JArXSSm61");
|
||||||
|
assertInvalidAddress("fbRXmJUDgf5URuVGyM223P8R2JArXSSm6u");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,9 @@ public class MegaCoinTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
assertInvalidAddress("mWXQfp3wKnir6krS4SQFAxzv1AExpfFMbq");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
|
assertInvalidAddress("MEfn9iWMjowxQaNOZEbtT7A34pvnJGPZ44");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
|
assertInvalidAddress("MRal1xTj5eAuxMR3xDPxLUG6RP3qR1ijuo");
|
||||||
|
assertInvalidAddress("M9pCgxBES9EgoNxoUnXxrnaMqYUwZVMttMt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ public class NeosTest extends AbstractAssetTest {
|
|||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
||||||
assertInvalidAddress("NScgetCW5bqDTVWFH3EYNMtTo5Rc#DxD6B");
|
assertInvalidAddress("NScgetCW5bqDTVWFH3EYNMtTo5Rc#DxD6B");
|
||||||
assertInvalidAddress("NeeAy35a0irpmTARHEXpP8uTmpPCcSD9Qn");
|
assertInvalidAddress("NeeAy35a0irpmTARHEXpP8uTmpPCcSD9Qn");
|
||||||
|
assertInvalidAddress("neeAy35aQirpmTARHEXpP8uTmpPCcSD9Qn");
|
||||||
assertInvalidAddress("NScgetCWRcvDxD6B");
|
assertInvalidAddress("NScgetCWRcvDxD6B");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,9 @@ public class NewPowerCoinTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("1111111111111111111111111111111111");
|
assertInvalidAddress("nXNc8LCAe2dHumQ9vTyogRXUzGw3PJHr55");
|
||||||
assertInvalidAddress("2222222222222222222222222222222222");
|
assertInvalidAddress("NhWDeD4UaNK20j8oSKr9u7EAUkCFZxEsDr");
|
||||||
assertInvalidAddress("3333333333333333333333333333333333");
|
assertInvalidAddress("NNTuHe4p5Xr8kyN2AJjJS9dcBoG1XQKkW6r");
|
||||||
|
assertInvalidAddress("NQebfMl6pijp2KvFHTKQktD4y2cSKknQEg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,11 @@ public class PIVXTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
assertInvalidAddress("dFJku78A14HYwPSzC5PtUmda7jMr5pbD2B");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
|
assertInvalidAddress("DAeiBSH4nudXgoxS4kY6uhTPobc7AlrWDA");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
|
assertInvalidAddress("DRbnCYbuMXdKU4y8dya9EnocL47gFjErWeg");
|
||||||
|
assertInvalidAddress("DTPAqTryNRCE2FgsxzohTtJXfCBODnG6Rc");
|
||||||
|
assertInvalidAddress("DTPAqTryNRCE2FgsxzohTtJXfCB0DnG6Rc");
|
||||||
|
assertInvalidAddress("DTPAqTryNRCE2FgsxzohTtJXfCBIDnG6Rc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,9 @@ public class PZDCTest extends AbstractAssetTest {
|
|||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("pGXsg0jSMzh1dSqggRvHjPvE3cnwvuXC7s");
|
assertInvalidAddress("pGXsg0jSMzh1dSqggRvHjPvE3cnwvuXC7s");
|
||||||
assertInvalidAddress("PKfRRcjwzKFq3dIqE9gq8Ztxn922W4GZhm");
|
assertInvalidAddress("PKfRRcjwzKFq3dIqE9gq8Ztxn922W4GZhm");
|
||||||
|
assertInvalidAddress("PKfRRcjwzKFq3d0qE9gq8Ztxn922W4GZhm");
|
||||||
|
assertInvalidAddress("PKfRRcjwzKFq3dOqE9gq8Ztxn922W4GZhm");
|
||||||
|
assertInvalidAddress("PKfRRcjwzKFq3dlqE9gq8Ztxn922W4GZhm");
|
||||||
assertInvalidAddress("PXP75NnwDryYswQb9RaPFBchqLRSvBmDP");
|
assertInvalidAddress("PXP75NnwDryYswQb9RaPFBchqLRSvBmDP");
|
||||||
assertInvalidAddress("PKr3vQ7S");
|
assertInvalidAddress("PKr3vQ7S");
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,11 @@ public class QMCoinTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq");
|
assertInvalidAddress("qSXwS2opau1PYsvj4PrirPkP6LQHeKbQDx");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO");
|
assertInvalidAddress("QbvD8CPJwAmpQoE8CQhzcfWp1EAmT2E2989");
|
||||||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#");
|
assertInvalidAddress("QUAzsb7nq07XVsRy9vjaE4kTUpgP1pFeoL");
|
||||||
|
assertInvalidAddress("QQDvVM2s3WYa8EZQS1s2OsRkR4zmrjy94d");
|
||||||
|
assertInvalidAddress("QgdkWtsy1inr9j8RUrqDIVnrJmhE28WnLX");
|
||||||
|
assertInvalidAddress("Qii56aanBMiEPpjHoaE4lgEW4jPuhGjuj5");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ public class SUB1XTest extends AbstractAssetTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidAddresses() {
|
public void testInvalidAddresses() {
|
||||||
|
assertInvalidAddress("zKi6EksPCZoMi6EGXS9vWVed4NeSov2ZS4");
|
||||||
assertInvalidAddress("ZDxdoVuyosZ6vY3LZAP1Z4H4eXMq2ZpAC7");
|
assertInvalidAddress("ZDxdoVuyosZ6vY3LZAP1Z4H4eXMq2ZpAC7");
|
||||||
assertInvalidAddress("ZKi6EksPCZoMi6EGXS9vWVedqwfov2ZS4");
|
assertInvalidAddress("ZKi6EksPCZoMi6EGXS9vWVedqwfov2ZS4");
|
||||||
assertInvalidAddress("ZT29B3yDJq1jzkqwrwBs4LnraM3E854MAPRm");
|
assertInvalidAddress("ZT29B3yDJq1jzkqwrwBs4LnraM3E854MAPRm");
|
||||||
|
Loading…
Reference in New Issue
Block a user