mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #2981 from fflo/master-namecoin
Namecoin (NMC) update AddressValidator
This commit is contained in:
commit
65b4043167
@ -17,12 +17,20 @@
|
||||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.Base58BitcoinAddressValidator;
|
||||
import bisq.asset.Coin;
|
||||
import bisq.asset.DefaultAddressValidator;
|
||||
import bisq.asset.NetworkParametersAdapter;
|
||||
|
||||
public class Namecoin extends Coin {
|
||||
|
||||
public Namecoin() {
|
||||
super("Namecoin", "NMC", new DefaultAddressValidator());
|
||||
super("Namecoin", "NMC", new Base58BitcoinAddressValidator(new NamecoinChainParams()));
|
||||
}
|
||||
|
||||
public static class NamecoinChainParams extends NetworkParametersAdapter {
|
||||
public NamecoinChainParams() {
|
||||
addressHeader = 52;
|
||||
acceptableAddressCodes = new int[]{addressHeader};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,29 @@
|
||||
|
||||
package bisq.asset.coins;
|
||||
|
||||
import bisq.asset.AbstractAssetWithDefaultValidatorTest;
|
||||
import org.junit.Test;
|
||||
import bisq.asset.AbstractAssetTest;
|
||||
|
||||
public class NamecoinTest extends AbstractAssetWithDefaultValidatorTest {
|
||||
public class NamecoinTest extends AbstractAssetTest {
|
||||
|
||||
public NamecoinTest() {
|
||||
super(new Namecoin());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidAddresses() {
|
||||
assertValidAddress("N7yhcPhzFduWXPc11AUK9zvtnsL6sgxmRs");
|
||||
assertValidAddress("N22FRU9f3fx7Hty641D5cg95kRK6S3sbf3");
|
||||
assertValidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidAddresses() {
|
||||
assertInvalidAddress("N7yhcPhzFduWXPc11AUK9zvtnsL6sgxmRsx");
|
||||
assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQer");
|
||||
assertInvalidAddress("bc1qus65zpte6qa2408qu3540lfcyj9cx7dphfcspn");
|
||||
assertInvalidAddress("3GyEtTwXhxbjBtmAR3CtzeayAyshtvd44P");
|
||||
assertInvalidAddress("1CnXYrivw7pJy3asKftp41wRPgBggF9fBw");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user