Add testnet genesis tx

This commit is contained in:
Manfred Karrer 2018-09-25 22:42:34 -05:00
parent 70f6a712f7
commit cd8ff29aa5
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46

View File

@ -18,6 +18,7 @@
package bisq.core.dao.state;
import bisq.core.app.BisqEnvironment;
import bisq.core.btc.BaseCurrencyNetwork;
import bisq.core.dao.DaoOptionKeys;
import org.bitcoinj.core.Coin;
@ -46,8 +47,11 @@ public class GenesisTxInfo {
public static final Coin GENESIS_TOTAL_SUPPLY = Coin.parseCoin("2.5");
private static final String DEFAULT_GENESIS_TX_ID = "81855816eca165f17f0668898faa8724a105196e90ffc4993f4cac980176674e";
private static final int DEFAULT_GENESIS_BLOCK_HEIGHT = 524717; // 2018-05-27
private static final String MAINNET_GENESIS_TX_ID = "81855816eca165f17f0668898faa8724a105196e90ffc4993f4cac980176674e";
private static final int MAINNET_GENESIS_BLOCK_HEIGHT = 524717; // 2018-05-27
private static final String TESTNET_GENESIS_TX_ID = "7085539068b4fc27dfc6c39b0feae2adc7fe20f925e79ca0ba064725fe6c9991";
private static final int TESTNET_GENESIS_BLOCK_HEIGHT = 1414332; // 2018-09-25
///////////////////////////////////////////////////////////////////////////////////////////
@ -61,14 +65,6 @@ public class GenesisTxInfo {
@Getter
private final int genesisBlockHeight;
//TODO not sure if we will use that
/* private static final int ISSUANCE_MATURITY = 144 * 30; // 30 days
static int getIssuanceMaturity() {
return ISSUANCE_MATURITY;
}*/
// mainnet
// this tx has a lot of outputs
// https://blockchain.info/de/tx/ee921650ab3f978881b8fe291e0c025e0da2b7dc684003d7a03d9649dfee2e15
@ -86,7 +82,6 @@ public class GenesisTxInfo {
// private static final String DEFAULT_GENESIS_TX_ID = "--";
// private static final int DEFAULT_GENESIS_BLOCK_HEIGHT = 499000; // recursive test 137298, 499000 dec 2017
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@ -94,11 +89,15 @@ public class GenesisTxInfo {
@Inject
public GenesisTxInfo(@Nullable @Named(DaoOptionKeys.GENESIS_TX_ID) String genesisTxId,
@Named(DaoOptionKeys.GENESIS_BLOCK_HEIGHT) int genesisBlockHeight) {
boolean isMainnet = BisqEnvironment.getBaseCurrencyNetwork().isMainnet();
BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
boolean isMainnet = baseCurrencyNetwork.isMainnet();
boolean isTestnet = baseCurrencyNetwork.isTestnet();
if (genesisTxId != null && !genesisTxId.isEmpty()) {
this.genesisTxId = genesisTxId;
} else if (isMainnet) {
this.genesisTxId = DEFAULT_GENESIS_TX_ID;
this.genesisTxId = MAINNET_GENESIS_TX_ID;
} else if (isTestnet) {
this.genesisTxId = TESTNET_GENESIS_TX_ID;
} else {
this.genesisTxId = "genesisTxId is undefined";
}
@ -106,7 +105,9 @@ public class GenesisTxInfo {
if (genesisBlockHeight != 0) {
this.genesisBlockHeight = genesisBlockHeight;
} else if (isMainnet) {
this.genesisBlockHeight = DEFAULT_GENESIS_BLOCK_HEIGHT;
this.genesisBlockHeight = MAINNET_GENESIS_BLOCK_HEIGHT;
} else if (isTestnet) {
this.genesisBlockHeight = TESTNET_GENESIS_BLOCK_HEIGHT;
} else {
this.genesisBlockHeight = 0;
}