diff --git a/assets/src/main/java/bisq/asset/coins/Bitmark.java b/assets/src/main/java/bisq/asset/coins/Bitmark.java index 03af875f3b0..6ed94f75c42 100644 --- a/assets/src/main/java/bisq/asset/coins/Bitmark.java +++ b/assets/src/main/java/bisq/asset/coins/Bitmark.java @@ -18,11 +18,20 @@ package bisq.asset.coins; import bisq.asset.Coin; -import bisq.asset.DefaultAddressValidator; +import bisq.asset.Base58BitcoinAddressValidator; +import bisq.asset.NetworkParametersAdapter; public class Bitmark extends Coin { + public static class BitmarkParams extends NetworkParametersAdapter { + public BitmarkParams() { + addressHeader = 85; + p2shHeader = 5; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } + public Bitmark() { - super("Bitmark", "BTM", new DefaultAddressValidator()); + super("Bitmark", "BTM", new Base58BitcoinAddressValidator(new BitmarkParams())); } } diff --git a/assets/src/test/java/bisq/asset/coins/BitmarkTest.java b/assets/src/test/java/bisq/asset/coins/BitmarkTest.java index 480974aa2d3..b443275085f 100644 --- a/assets/src/test/java/bisq/asset/coins/BitmarkTest.java +++ b/assets/src/test/java/bisq/asset/coins/BitmarkTest.java @@ -17,11 +17,25 @@ package bisq.asset.coins; -import bisq.asset.AbstractAssetWithDefaultValidatorTest; +import bisq.asset.AbstractAssetTest; +import org.junit.Test; -public class BitmarkTest extends AbstractAssetWithDefaultValidatorTest { +public class BitmarkTest extends AbstractAssetTest { public BitmarkTest() { super(new Bitmark()); } + + @Test + public void testValidAddresses() { + assertValidAddress("bMigVohTEiA3gxhFWpDJBrZ14j2RnDkWCs"); + assertValidAddress("bKMivcHXMNfs3P3AaTtyhDiZ7s8Nw3ek6L"); + assertValidAddress("bXUYGzbV8v6pLZtkYDL3feyrRFFnc37e3H"); + } + @Test + public void testInvalidAddresses() { + assertInvalidAddress("bMigVohTEiA3gxhFWpDJBrZ14j2RnDkWCt"); + assertInvalidAddress("F9z7PKmo1sLQYtFuZjTQ1zZXhPQtHLScKT"); + assertInvalidAddress("16Ftsh4Ff2ijPNsnQAUf5fKTp7DJaGxSZK"); + } }