mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 06:47:54 +01:00
AbstractBitcoinNetParams: Move assignment of interval and subsidyDecreaseBlockCount to here.
This also adds a test of isDifficultyTransitionPoint().
This commit is contained in:
parent
0fe5f99798
commit
3db1b651c9
4 changed files with 9 additions and 4 deletions
|
@ -56,6 +56,8 @@ public abstract class AbstractBitcoinNetParams extends NetworkParameters {
|
|||
|
||||
public AbstractBitcoinNetParams() {
|
||||
super();
|
||||
interval = INTERVAL;
|
||||
subsidyDecreaseBlockCount = 210000;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,6 @@ public class MainNetParams extends AbstractBitcoinNetParams {
|
|||
|
||||
public MainNetParams() {
|
||||
super();
|
||||
interval = INTERVAL;
|
||||
targetTimespan = TARGET_TIMESPAN;
|
||||
maxTarget = Utils.decodeCompactBits(0x1d00ffffL);
|
||||
dumpedPrivateKeyHeader = 128;
|
||||
|
@ -56,7 +55,6 @@ public class MainNetParams extends AbstractBitcoinNetParams {
|
|||
genesisBlock.setTime(1231006505L);
|
||||
genesisBlock.setNonce(2083236893);
|
||||
id = ID_MAINNET;
|
||||
subsidyDecreaseBlockCount = 210000;
|
||||
spendableCoinbaseDepth = 100;
|
||||
String genesisHash = genesisBlock.getHashAsString();
|
||||
checkState(genesisHash.equals("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"),
|
||||
|
|
|
@ -46,7 +46,6 @@ public class TestNet3Params extends AbstractBitcoinNetParams {
|
|||
super();
|
||||
id = ID_TESTNET;
|
||||
packetMagic = 0x0b110907;
|
||||
interval = INTERVAL;
|
||||
targetTimespan = TARGET_TIMESPAN;
|
||||
maxTarget = Utils.decodeCompactBits(0x1d00ffffL);
|
||||
port = 18333;
|
||||
|
@ -58,7 +57,6 @@ public class TestNet3Params extends AbstractBitcoinNetParams {
|
|||
genesisBlock.setDifficultyTarget(0x1d00ffffL);
|
||||
genesisBlock.setNonce(414098458);
|
||||
spendableCoinbaseDepth = 100;
|
||||
subsidyDecreaseBlockCount = 210000;
|
||||
String genesisHash = genesisBlock.getHashAsString();
|
||||
checkState(genesisHash.equals("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
|
||||
alertSigningKey = Utils.HEX.decode("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a");
|
||||
|
|
|
@ -29,6 +29,13 @@ public class AbstractBitcoinNetParamsTest {
|
|||
}
|
||||
};
|
||||
|
||||
@Test
|
||||
public void isDifficultyTransitionPoint() {
|
||||
assertFalse(BITCOIN_PARAMS.isDifficultyTransitionPoint(2014));
|
||||
assertTrue(BITCOIN_PARAMS.isDifficultyTransitionPoint(2015));
|
||||
assertFalse(BITCOIN_PARAMS.isDifficultyTransitionPoint(2016));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isRewardHalvingPoint() {
|
||||
assertTrue(BITCOIN_PARAMS.isRewardHalvingPoint(209999));
|
||||
|
|
Loading…
Add table
Reference in a new issue