mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Merge pull request #746 from jonspock/Development
Add PivxParams file and make sure unit test passes
This commit is contained in:
commit
cded723173
2 changed files with 83 additions and 4 deletions
|
@ -20,6 +20,7 @@ package io.bitsquare.gui.util.validation;
|
|||
|
||||
import io.bitsquare.gui.util.validation.altcoins.ByteballAddressValidator;
|
||||
import io.bitsquare.gui.util.validation.params.IOPParams;
|
||||
import io.bitsquare.gui.util.validation.params.PivxParams;
|
||||
import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.AddressFormatException;
|
||||
import org.bitcoinj.params.MainNetParams;
|
||||
|
@ -72,11 +73,11 @@ public final class AltCoinAddressValidator extends InputValidator {
|
|||
} else {
|
||||
return regexTestFailed;
|
||||
}
|
||||
/*case "PIVX":
|
||||
if (input.matches("^[D][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
|
||||
case "PIVX":
|
||||
if (input.matches("^[D][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
|
||||
if (verifyChecksum(input)) {
|
||||
try {
|
||||
new Address(MainNetParams.get(), input);
|
||||
new Address(PivxParams.get(), input);
|
||||
return new ValidationResult(true);
|
||||
} catch (AddressFormatException e) {
|
||||
return new ValidationResult(false, getErrorMessage(e));
|
||||
|
@ -86,7 +87,7 @@ public final class AltCoinAddressValidator extends InputValidator {
|
|||
}
|
||||
} else {
|
||||
return regexTestFailed;
|
||||
}*/
|
||||
}
|
||||
case "IOP":
|
||||
if (input.matches("^[p][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
|
||||
if (verifyChecksum(input)) {
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.util.validation.params;
|
||||
|
||||
import org.bitcoinj.core.*;
|
||||
import org.bitcoinj.store.BlockStore;
|
||||
import org.bitcoinj.store.BlockStoreException;
|
||||
import org.bitcoinj.utils.MonetaryFormat;
|
||||
|
||||
public class PivxParams extends NetworkParameters {
|
||||
|
||||
private static PivxParams instance;
|
||||
|
||||
public static synchronized PivxParams get() {
|
||||
if (instance == null) {
|
||||
instance = new PivxParams();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
// We only use the properties needed for address validation
|
||||
public PivxParams() {
|
||||
super();
|
||||
addressHeader = 30;
|
||||
p2shHeader = 13;
|
||||
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
|
||||
}
|
||||
|
||||
// default dummy implementations, not used...
|
||||
@Override
|
||||
public String getPaymentProtocolId() {
|
||||
return PAYMENT_PROTOCOL_ID_MAINNET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coin getMaxMoney() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coin getMinNonDustOutput() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonetaryFormat getMonetaryFormat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUriScheme() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMaxMoney() {
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue