@@ -270,7 +294,7 @@ public class PaymentProtocol {
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("displayName", displayName)
.add("rootAuthorityName", rootAuthorityName)
.add("merchantSigningKey", merchantSigningKey)
diff --git a/core/src/main/java/org/bitcoinj/core/AltcoinBlock.java b/core/src/main/java/org/bitcoinj/core/AltcoinBlock.java
index 62e320cf..f35bb2b1 100644
--- a/core/src/main/java/org/bitcoinj/core/AltcoinBlock.java
+++ b/core/src/main/java/org/bitcoinj/core/AltcoinBlock.java
@@ -17,10 +17,9 @@
package org.bitcoinj.core;
-import org.libdohj.core.AltcoinNetworkParameters;
-import com.google.common.base.Preconditions;
+import static org.bitcoinj.core.Utils.reverseBytes;
+import static org.libdohj.core.Utils.scryptDigest;
-import javax.annotation.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -28,13 +27,12 @@ import java.math.BigInteger;
import java.security.GeneralSecurityException;
import java.util.BitSet;
import java.util.List;
-import static org.bitcoinj.core.Coin.FIFTY_COINS;
-import org.libdohj.core.ScryptHash;
-import static org.libdohj.core.Utils.scryptDigest;
+import javax.annotation.Nullable;
-import static org.bitcoinj.core.Utils.reverseBytes;
+import org.libdohj.core.AltcoinNetworkParameters;
import org.libdohj.core.AuxPoWNetworkParameters;
+import org.libdohj.params.AbstractLitecoinParams;
/**
* A block is a group of transactions, and is one of the fundamental data structures of the Bitcoin system.
@@ -61,7 +59,7 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
*/
private boolean auxpowChain = false;
- private ScryptHash scryptHash;
+ private Sha256Hash scryptHash;
/** Special case constructor, used for the genesis node, cloneAsHeader and unit tests.
* @param params NetworkParameters object.
@@ -113,11 +111,11 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
super(params, version, prevBlockHash, merkleRoot, time, difficultyTarget, nonce, transactions);
}
- private ScryptHash calculateScryptHash() {
+ private Sha256Hash calculateScryptHash() {
try {
ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE);
writeHeader(bos);
- return new ScryptHash(reverseBytes(scryptDigest(bos.toByteArray())));
+ return Sha256Hash.wrap(reverseBytes(scryptDigest(bos.toByteArray())));
} catch (IOException e) {
throw new RuntimeException(e); // Cannot happen.
} catch (GeneralSecurityException e) {
@@ -137,7 +135,7 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
* Returns the Scrypt hash of the block (which for a valid, solved block should be
* below the target). Big endian.
*/
- public ScryptHash getScryptHash() {
+ public Sha256Hash getScryptHash() {
if (scryptHash == null)
scryptHash = calculateScryptHash();
return scryptHash;
@@ -207,7 +205,9 @@ public class AltcoinBlock extends org.bitcoinj.core.Block {
@Override
public long getVersion() {
// TODO: Can we cache the individual parts on parse?
- if (this.params instanceof AltcoinNetworkParameters) {
+ if(this.params instanceof AbstractLitecoinParams) {
+ return super.getVersion();
+ } else if (this.params instanceof AltcoinNetworkParameters) {
// AuxPoW networks use the higher block version bits for flags and
// chain ID.
return getBaseVersion(super.getVersion());
diff --git a/core/src/main/java/org/bitcoinj/core/AuxPoW.java b/core/src/main/java/org/bitcoinj/core/AuxPoW.java
index 0d1ac04e..c215df57 100644
--- a/core/src/main/java/org/bitcoinj/core/AuxPoW.java
+++ b/core/src/main/java/org/bitcoinj/core/AuxPoW.java
@@ -122,7 +122,7 @@ public class AuxPoW extends ChildMessage {
@Override
protected void parse() throws ProtocolException {
cursor = offset;
- transaction = new Transaction(params, payload, cursor, this, serializer, Message.UNKNOWN_LENGTH);
+ transaction = new Transaction(params, payload, cursor, this, serializer, Message.UNKNOWN_LENGTH, null);
cursor += transaction.getOptimalEncodingMessageSize();
optimalEncodingMessageSize = transaction.getOptimalEncodingMessageSize();
@@ -163,7 +163,7 @@ public class AuxPoW extends ChildMessage {
* @param chain If provided, will be used to estimate lock times (if set). Can be null.
*/
public String toString(@Nullable AbstractBlockChain chain) {
- return transaction.toString(chain);
+ return transaction.toString(chain, null);
}
@Override
diff --git a/core/src/main/java/org/libdohj/core/ScryptHash.java b/core/src/main/java/org/libdohj/core/ScryptHash.java
index a2af7f4e..2d25e49d 100644
--- a/core/src/main/java/org/libdohj/core/ScryptHash.java
+++ b/core/src/main/java/org/libdohj/core/ScryptHash.java
@@ -23,8 +23,9 @@ import org.bitcoinj.core.Sha256Hash;
* but in time the two classes should have a common superclass rather than one
* extending the other directly.
*/
-public class ScryptHash extends Sha256Hash {
+public class ScryptHash { // extends Sha256Hash {
+ /*
public ScryptHash(byte[] rawHashBytes) {
super(rawHashBytes);
}
@@ -32,4 +33,5 @@ public class ScryptHash extends Sha256Hash {
public ScryptHash(String hexString) {
super(hexString);
}
+ */
}
diff --git a/core/src/main/java/org/libdohj/core/Utils.java b/core/src/main/java/org/libdohj/core/Utils.java
index 6fc78b87..aa22a256 100644
--- a/core/src/main/java/org/libdohj/core/Utils.java
+++ b/core/src/main/java/org/libdohj/core/Utils.java
@@ -16,9 +16,10 @@
*/
package org.libdohj.core;
-import com.lambdaworks.crypto.SCrypt;
import java.security.GeneralSecurityException;
+import org.bouncycastle.crypto.generators.SCrypt;
+
/**
*
*/
@@ -28,6 +29,6 @@ public class Utils {
* The resulting hash is in small endian form.
*/
public static byte[] scryptDigest(byte[] input) throws GeneralSecurityException {
- return SCrypt.scrypt(input, input, 1024, 1, 1, 32);
+ return SCrypt.generate(input, input, 1024, 1, 1, 32);
}
}
diff --git a/core/src/main/java/org/libdohj/names/NameTransactionUtils.java b/core/src/main/java/org/libdohj/names/NameTransactionUtils.java
index fca9bdae..a842509a 100644
--- a/core/src/main/java/org/libdohj/names/NameTransactionUtils.java
+++ b/core/src/main/java/org/libdohj/names/NameTransactionUtils.java
@@ -18,7 +18,7 @@ package org.libdohj.names;
import org.libdohj.script.NameScript;
-import org.bitcoinj.core.ScriptException;
+import org.bitcoinj.script.ScriptException;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionOutput;
import org.bitcoinj.script.Script;
diff --git a/core/src/main/java/org/libdohj/params/AbstractDogecoinParams.java b/core/src/main/java/org/libdohj/params/AbstractDogecoinParams.java
index 6127ba6d..280c7b25 100644
--- a/core/src/main/java/org/libdohj/params/AbstractDogecoinParams.java
+++ b/core/src/main/java/org/libdohj/params/AbstractDogecoinParams.java
@@ -108,8 +108,8 @@ public abstract class AbstractDogecoinParams extends NetworkParameters implement
diffChangeTarget = setDiffChangeTarget;
packetMagic = 0xc0c0c0c0;
- bip32HeaderPub = 0x0488C42E; //The 4 byte header that serializes in base58 to "xpub". (?)
- bip32HeaderPriv = 0x0488E1F4; //The 4 byte header that serializes in base58 to "xprv" (?)
+ bip32HeaderP2PKHpub = 0x0488C42E; //The 4 byte header that serializes in base58 to "xpub". (?)
+ bip32HeaderP2PKHpriv = 0x0488E1F4; //The 4 byte header that serializes in base58 to "xprv" (?)
}
private static AltcoinBlock createGenesis(NetworkParameters params) {
diff --git a/core/src/main/java/org/libdohj/params/AbstractLitecoinParams.java b/core/src/main/java/org/libdohj/params/AbstractLitecoinParams.java
index 8e9cba8f..af922268 100644
--- a/core/src/main/java/org/libdohj/params/AbstractLitecoinParams.java
+++ b/core/src/main/java/org/libdohj/params/AbstractLitecoinParams.java
@@ -89,8 +89,8 @@ public abstract class AbstractLitecoinParams extends NetworkParameters implement
maxTarget = Utils.decodeCompactBits(0x1e0fffffL);
packetMagic = 0xfbc0b6db;
- bip32HeaderPub = 0x0488C42E; //The 4 byte header that serializes in base58 to "xpub". (?)
- bip32HeaderPriv = 0x0488E1F4; //The 4 byte header that serializes in base58 to "xprv" (?)
+ bip32HeaderP2PKHpub = 0x0488C42E; //The 4 byte header that serializes in base58 to "xpub". (?)
+ bip32HeaderP2PKHpriv = 0x0488E1F4; //The 4 byte header that serializes in base58 to "xprv" (?)
}
@Override
@@ -117,7 +117,7 @@ public abstract class AbstractLitecoinParams extends NetworkParameters implement
@Override
public Coin getMinNonDustOutput() {
- return Coin.COIN;
+ return Coin.valueOf(100000);
}
@Override
diff --git a/core/src/main/java/org/libdohj/params/AbstractNamecoinParams.java b/core/src/main/java/org/libdohj/params/AbstractNamecoinParams.java
index c0d6165a..a9dbcaf6 100644
--- a/core/src/main/java/org/libdohj/params/AbstractNamecoinParams.java
+++ b/core/src/main/java/org/libdohj/params/AbstractNamecoinParams.java
@@ -98,8 +98,8 @@ public abstract class AbstractNamecoinParams extends NetworkParameters implement
maxTarget = Utils.decodeCompactBits(0x1e0fffffL); // TODO: figure out the Namecoin value of this
// BIP 43 recommends using these values regardless of which blockchain is in use.
- bip32HeaderPub = 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub".
- bip32HeaderPriv = 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv"
+ bip32HeaderP2PKHpub = 0x0488B21E; //The 4 byte header that serializes in base58 to "xpub".
+ bip32HeaderP2PKHpriv = 0x0488ADE4; //The 4 byte header that serializes in base58 to "xprv"
}
private static AltcoinBlock createGenesis(NetworkParameters params) {
diff --git a/core/src/main/java/org/libdohj/params/DogecoinMainNetParams.java b/core/src/main/java/org/libdohj/params/DogecoinMainNetParams.java
index 8df9cf4c..d42485bd 100644
--- a/core/src/main/java/org/libdohj/params/DogecoinMainNetParams.java
+++ b/core/src/main/java/org/libdohj/params/DogecoinMainNetParams.java
@@ -35,14 +35,14 @@ public class DogecoinMainNetParams extends AbstractDogecoinParams {
dumpedPrivateKeyHeader = 158; //This is always addressHeader + 128
addressHeader = 30;
p2shHeader = 22;
- acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
+ // acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
port = 22556;
packetMagic = 0xc0c0c0c0;
// Note that while BIP44 makes HD wallets chain-agnostic, for legacy
// reasons we use a Doge-specific header for main net. At some point
// we'll add independent headers for BIP32 legacy and BIP44.
- bip32HeaderPub = 0x02facafd; //The 4 byte header that serializes in base58 to "dgub".
- bip32HeaderPriv = 0x02fac398; //The 4 byte header that serializes in base58 to "dgpv".
+ bip32HeaderP2PKHpub = 0x02facafd; //The 4 byte header that serializes in base58 to "dgub".
+ bip32HeaderP2PKHpriv = 0x02fac398; //The 4 byte header that serializes in base58 to "dgpv".
genesisBlock.setDifficultyTarget(0x1e0ffff0L);
genesisBlock.setTime(1386325540L);
genesisBlock.setNonce(99943L);
diff --git a/core/src/main/java/org/libdohj/params/DogecoinTestNet3Params.java b/core/src/main/java/org/libdohj/params/DogecoinTestNet3Params.java
index db406ce2..9bb4841b 100644
--- a/core/src/main/java/org/libdohj/params/DogecoinTestNet3Params.java
+++ b/core/src/main/java/org/libdohj/params/DogecoinTestNet3Params.java
@@ -18,7 +18,7 @@
package org.libdohj.params;
import org.bitcoinj.core.Utils;
-import org.spongycastle.util.encoders.Hex;
+import org.bouncycastle.util.encoders.Hex;
import static com.google.common.base.Preconditions.checkState;
@@ -43,7 +43,7 @@ public class DogecoinTestNet3Params extends AbstractDogecoinParams {
port = 44556;
addressHeader = 113;
p2shHeader = 196;
- acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
+ // acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
dumpedPrivateKeyHeader = 241;
genesisBlock.setTime(1391503289L);
genesisBlock.setDifficultyTarget(0x1e0ffff0L);
@@ -63,8 +63,8 @@ public class DogecoinTestNet3Params extends AbstractDogecoinParams {
};
// Note this is the same as the BIP32 testnet, as BIP44 makes HD wallets
// chain agnostic. Dogecoin mainnet has its own headers for legacy reasons.
- bip32HeaderPub = 0x043587CF;
- bip32HeaderPriv = 0x04358394;
+ bip32HeaderP2PKHpub = 0x043587CF;
+ bip32HeaderP2PKHpriv = 0x04358394;
}
private static DogecoinTestNet3Params instance;
diff --git a/core/src/main/java/org/libdohj/params/LitecoinMainNetParams.java b/core/src/main/java/org/libdohj/params/LitecoinMainNetParams.java
index 35b05228..f8799164 100644
--- a/core/src/main/java/org/libdohj/params/LitecoinMainNetParams.java
+++ b/core/src/main/java/org/libdohj/params/LitecoinMainNetParams.java
@@ -18,8 +18,6 @@
package org.libdohj.params;
import org.bitcoinj.core.Utils;
-import org.spongycastle.util.encoders.Hex;
-
import static com.google.common.base.Preconditions.checkState;
import java.io.ByteArrayOutputStream;
import org.bitcoinj.core.AltcoinBlock;
@@ -32,6 +30,7 @@ import org.bitcoinj.core.TransactionOutput;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptOpCodes;
+import org.bouncycastle.util.encoders.Hex;
/**
* Parameters for the Litecoin main production network on which people trade
@@ -52,7 +51,7 @@ public class LitecoinMainNetParams extends AbstractLitecoinParams {
port = 9333;
addressHeader = 48;
p2shHeader = 5;
- acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
+ // acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
dumpedPrivateKeyHeader = 176;
this.genesisBlock = createGenesis(this);
@@ -74,8 +73,8 @@ public class LitecoinMainNetParams extends AbstractLitecoinParams {
"dnsseed.koin-project.com",
"dnsseed.weminemnc.com"
};
- bip32HeaderPub = 0x0488B21E;
- bip32HeaderPriv = 0x0488ADE4;
+ bip32HeaderP2PKHpub = 0x0488B21E;
+ bip32HeaderP2PKHpriv = 0x0488ADE4;
}
private static AltcoinBlock createGenesis(NetworkParameters params) {
diff --git a/core/src/main/java/org/libdohj/params/LitecoinTestNet3Params.java b/core/src/main/java/org/libdohj/params/LitecoinTestNet3Params.java
index e9b8dc7e..e45e2fe5 100644
--- a/core/src/main/java/org/libdohj/params/LitecoinTestNet3Params.java
+++ b/core/src/main/java/org/libdohj/params/LitecoinTestNet3Params.java
@@ -18,7 +18,6 @@
package org.libdohj.params;
import org.bitcoinj.core.Utils;
-import org.spongycastle.util.encoders.Hex;
import static com.google.common.base.Preconditions.checkState;
import java.io.ByteArrayOutputStream;
@@ -31,6 +30,7 @@ import org.bitcoinj.core.TransactionInput;
import org.bitcoinj.core.TransactionOutput;
import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptOpCodes;
+import org.bouncycastle.util.encoders.Hex;
/**
* Parameters for the testnet, a separate public instance of Litecoin that has
@@ -52,7 +52,7 @@ public class LitecoinTestNet3Params extends AbstractLitecoinParams {
port = 19333;
addressHeader = 111;
p2shHeader = 196;
- acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
+ // acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
dumpedPrivateKeyHeader = 239;
this.genesisBlock = createGenesis(this);
@@ -73,8 +73,8 @@ public class LitecoinTestNet3Params extends AbstractLitecoinParams {
"dnsseed.wemine-testnet.com"
};
- bip32HeaderPub = 0x043587CF;
- bip32HeaderPriv = 0x04358394;
+ bip32HeaderP2PKHpub = 0x043587CF;
+ bip32HeaderP2PKHpriv = 0x04358394;
}
private static AltcoinBlock createGenesis(NetworkParameters params) {
diff --git a/core/src/main/java/org/libdohj/params/NamecoinMainNetParams.java b/core/src/main/java/org/libdohj/params/NamecoinMainNetParams.java
deleted file mode 100644
index 0da4f6dd..00000000
--- a/core/src/main/java/org/libdohj/params/NamecoinMainNetParams.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2013 Google Inc, 2016 Jeremy Rand.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.libdohj.params;
-
-import org.bitcoinj.core.Sha256Hash;
-import org.spongycastle.util.encoders.Hex;
-
-import static com.google.common.base.Preconditions.checkState;
-
-// TODO: review this
-
-/**
- * Parameters for the main Namecoin production network on which people trade
- * goods and services.
- */
-public class NamecoinMainNetParams extends AbstractNamecoinParams {
- public static final int MAINNET_MAJORITY_WINDOW = 1000;
- public static final int MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED = 950;
- public static final int MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE = 750;
-
- public NamecoinMainNetParams() {
- super();
- dumpedPrivateKeyHeader = 180; //This is always addressHeader + 128
- addressHeader = 52;
- p2shHeader = 13;
- //acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
- acceptableAddressCodes = new int[] { addressHeader }; // Namecoin doesn't yet enforce P2SH, so we disable it for now.
- port = 8334;
- packetMagic = 0xf9beb4fe;
-
- genesisBlock.setDifficultyTarget(0x1C007FFFL);
- genesisBlock.setTime(1303000001L);
- genesisBlock.setNonce(2719916434L);
- id = ID_NMC_MAINNET;
- subsidyDecreaseBlockCount = 210000;
- spendableCoinbaseDepth = 100;
- auxpowStartHeight = 19200;
-
- String genesisHash = genesisBlock.getHashAsString();
- checkState(genesisHash.equals("000000000062b72c5e2ceb45fbc8587e807c155b0da735e6483dfba2f0a9c770"),
- genesisHash);
- // TODO: remove alert key since it's removed from Bitcoin Core / Namecoin Core
- alertSigningKey = Hex.decode("04ba207043c1575208f08ea6ac27ed2aedd4f84e70b874db129acb08e6109a3bbb7c479ae22565973ebf0ac0391514511a22cb9345bdb772be20cfbd38be578b0c");
-
- majorityEnforceBlockUpgrade = MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE;
- majorityRejectBlockOutdated = MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED;
- majorityWindow = MAINNET_MAJORITY_WINDOW;
-
- // TODO: check whether there are any non BIP30 blocks in Namecoin; add them here if they exist
- // This contains (at a minimum) the blocks which are not BIP30 compliant. BIP30 changed how duplicate
- // transactions are handled. Duplicated transactions could occur in the case where a coinbase had the same
- // extraNonce and the same outputs but appeared at different heights, and greatly complicated re-org handling.
- // Having these here simplifies block connection logic considerably.
- checkpoints.put( 2016, Sha256Hash.wrap("0000000000660bad0d9fbde55ba7ee14ddf766ed5f527e3fbca523ac11460b92"));
- checkpoints.put( 4032, Sha256Hash.wrap("0000000000493b5696ad482deb79da835fe2385304b841beef1938655ddbc411"));
- checkpoints.put( 6048, Sha256Hash.wrap("000000000027939a2e1d8bb63f36c47da858e56d570f143e67e85068943470c9"));
- checkpoints.put( 8064, Sha256Hash.wrap("000000000003a01f708da7396e54d081701ea406ed163e519589717d8b7c95a5"));
- checkpoints.put( 10080, Sha256Hash.wrap("00000000000fed3899f818b2228b4f01b9a0a7eeee907abd172852df71c64b06"));
- checkpoints.put( 12096, Sha256Hash.wrap("0000000000006c06988ff361f124314f9f4bb45b6997d90a7ee4cedf434c670f"));
- checkpoints.put( 14112, Sha256Hash.wrap("00000000000045d95e0588c47c17d593c7b5cb4fb1e56213d1b3843c1773df2b"));
- checkpoints.put( 16128, Sha256Hash.wrap("000000000001d9964f9483f9096cf9d6c6c2886ed1e5dec95ad2aeec3ce72fa9"));
- checkpoints.put( 18940, Sha256Hash.wrap("00000000000087f7fc0c8085217503ba86f796fa4984f7e5a08b6c4c12906c05"));
- checkpoints.put( 30240, Sha256Hash.wrap("e1c8c862ff342358384d4c22fa6ea5f669f3e1cdcf34111f8017371c3c0be1da"));
- checkpoints.put( 57000, Sha256Hash.wrap("aa3ec60168a0200799e362e2b572ee01f3c3852030d07d036e0aa884ec61f203"));
- checkpoints.put(112896, Sha256Hash.wrap("73f880e78a04dd6a31efc8abf7ca5db4e262c4ae130d559730d6ccb8808095bf"));
- checkpoints.put(182000, Sha256Hash.wrap("d47b4a8fd282f635d66ce34ebbeb26ffd64c35b41f286646598abfd813cba6d9"));
- checkpoints.put(193000, Sha256Hash.wrap("3b85e70ba7f5433049cfbcf0ae35ed869496dbedcd1c0fafadb0284ec81d7b58"));
-
- dnsSeeds = new String[] {
- "namecoindnsseed.digi-masters.com", // George Lloyd
- "namecoindnsseed.digi-masters.uk", // George Lloyd
- "seed.namecoin.domob.eu", // Daniel Kraft
- "nmc.seed.quisquis.de", // Peter Conrad
- "dnsseed.namecoin.webbtc.com", // Marius Hanne
- };
-
- // TODO: look into HTTP seeds or Addr seeds as is done for Bitcoin
- }
-
- private static NamecoinMainNetParams instance;
- public static synchronized NamecoinMainNetParams get() {
- if (instance == null) {
- instance = new NamecoinMainNetParams();
- }
- return instance;
- }
-
- // TODO: re-add this when we introduce Testnet2
- /*
- @Override
- public boolean allowMinDifficultyBlocks() {
- return false;
- }
- */
-
- @Override
- public String getPaymentProtocolId() {
- // TODO: CHANGE THIS (comment from Dogecoin)
- return ID_NMC_MAINNET;
- }
-
- @Override
- public boolean isTestNet() {
- return false;
- }
-}
diff --git a/core/src/main/java/org/libdohj/script/NameScript.java b/core/src/main/java/org/libdohj/script/NameScript.java
index c545c45f..3839a353 100644
--- a/core/src/main/java/org/libdohj/script/NameScript.java
+++ b/core/src/main/java/org/libdohj/script/NameScript.java
@@ -16,10 +16,12 @@
package org.libdohj.script;
-import org.bitcoinj.core.ScriptException;
import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptBuilder;
import org.bitcoinj.script.ScriptChunk;
+import org.bitcoinj.script.ScriptError;
+import org.bitcoinj.script.ScriptException;
+
import static org.bitcoinj.script.ScriptOpCodes.*;
import java.util.ArrayList;
@@ -129,7 +131,7 @@ public class NameScript {
return false;
default:
- throw new ScriptException("Invalid name op");
+ throw new ScriptException(null, "Invalid name op");
}
}
@@ -149,7 +151,7 @@ public class NameScript {
return true;
default:
- throw new ScriptException("Not a name op");
+ throw new ScriptException(null, "Not a name op");
}
}
@@ -160,7 +162,7 @@ public class NameScript {
return args.get(0);
default:
- throw new ScriptException("Not an AnyUpdate op");
+ throw new ScriptException(null, "Not an AnyUpdate op");
}
}
@@ -173,7 +175,7 @@ public class NameScript {
return args.get(1);
default:
- throw new ScriptException("Not an AnyUpdate op");
+ throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Not an AnyUpdate op");
}
}