Package org.bitcoinj.testing
Class MockAltNetworkParams
- java.lang.Object
-
- org.bitcoinj.core.NetworkParameters
-
- org.bitcoinj.testing.MockAltNetworkParams
-
public class MockAltNetworkParams extends NetworkParameters
Mock Alt-net subclass ofNetworkParameters
for unit tests.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bitcoinj.core.NetworkParameters
NetworkParameters.ProtocolVersion
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MOCKNET_GOOD_ADDRESS
-
Fields inherited from class org.bitcoinj.core.NetworkParameters
addressHeader, addrSeeds, BIP16_ENFORCE_TIME, bip32HeaderP2PKHpriv, bip32HeaderP2PKHpub, bip32HeaderP2WPKHpriv, bip32HeaderP2WPKHpub, checkpoints, defaultSerializer, dnsSeeds, dumpedPrivateKeyHeader, id, interval, INTERVAL, majorityEnforceBlockUpgrade, majorityRejectBlockOutdated, majorityWindow, MAX_COINS, MAX_MONEY, maxTarget, network, p2shHeader, packetMagic, PAYMENT_PROTOCOL_ID_MAINNET, PAYMENT_PROTOCOL_ID_REGTEST, PAYMENT_PROTOCOL_ID_SIGNET, PAYMENT_PROTOCOL_ID_TESTNET, PAYMENT_PROTOCOL_ID_UNIT_TESTS, port, segwitAddressHrp, spendableCoinbaseDepth, subsidyDecreaseBlockCount, TARGET_SPACING, TARGET_TIMESPAN, targetTimespan
-
-
Constructor Summary
Constructors Constructor Description MockAltNetworkParams()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore)
Throws an exception if the block's difficulty is not correct.Block
getGenesisBlock()
Genesis block for this chain.Coin
getMaxMoney()
Returns the number of coins that will be produced in total, on this network.MonetaryFormat
getMonetaryFormat()
The monetary object for this currency.java.lang.String
getPaymentProtocolId()
int
getProtocolVersionNum(NetworkParameters.ProtocolVersion version)
BitcoinSerializer
getSerializer()
Construct and return a custom serializer.java.lang.String
getUriScheme()
Scheme part for URIs, for example "bitcoin".boolean
hasMaxMoney()
Returns whether this network has a maximum number of coins (finite supply) or not.-
Methods inherited from class org.bitcoinj.core.NetworkParameters
allowEmptyPeerChain, equals, fromAddress, fromID, fromPmtProtocolID, getAddressHeader, getAddrSeeds, getBip32HeaderP2PKHpriv, getBip32HeaderP2PKHpub, getBip32HeaderP2WPKHpriv, getBip32HeaderP2WPKHpub, getBlockVerificationFlags, getDefaultSerializer, getDnsSeeds, getDumpedPrivateKeyHeader, getId, getInterval, getMajorityEnforceBlockUpgrade, getMajorityRejectBlockOutdated, getMajorityWindow, getMaxTarget, getP2SHHeader, getPacketMagic, getPort, getSegwitAddressHrp, getSpendableCoinbaseDepth, getSubsidyDecreaseBlockCount, getTargetTimespan, getTransactionVerificationFlags, hashCode, isCheckpoint, network, of, passesCheckpoint
-
-
-
-
Field Detail
-
MOCKNET_GOOD_ADDRESS
public static final java.lang.String MOCKNET_GOOD_ADDRESS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPaymentProtocolId
public java.lang.String getPaymentProtocolId()
- Specified by:
getPaymentProtocolId
in classNetworkParameters
- Returns:
- the payment protocol network id string
-
checkDifficultyTransitions
public void checkDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) throws VerificationException, BlockStoreException
Description copied from class:NetworkParameters
Throws an exception if the block's difficulty is not correct.- Specified by:
checkDifficultyTransitions
in classNetworkParameters
- Parameters:
storedPrev
- previous stored blocknext
- proposed blockblockStore
- active BlockStore- Throws:
VerificationException
- if the block's difficulty is not correct.BlockStoreException
- if an error occurred accessing the BlockStore
-
getGenesisBlock
public Block getGenesisBlock()
Description copied from class:NetworkParameters
Genesis block for this chain.
The first block in every chain is a well known constant shared between all Bitcoin implementations. For a block to be valid, it must be eventually possible to work backwards to the genesis block by following the prevBlockHash pointers in the block headers.
The genesis blocks for both test and main networks contain the timestamp of when they were created, and a message in the coinbase transaction. It says, "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks".
- Specified by:
getGenesisBlock
in classNetworkParameters
- Returns:
- genesis block
-
getMaxMoney
public Coin getMaxMoney()
Description copied from class:NetworkParameters
Returns the number of coins that will be produced in total, on this network. Where not applicable, a very large number of coins is returned instead (e.g. the main coin issue for Dogecoin).- Specified by:
getMaxMoney
in classNetworkParameters
- Returns:
- maximum number of coins for this network
-
getMonetaryFormat
public MonetaryFormat getMonetaryFormat()
Description copied from class:NetworkParameters
The monetary object for this currency.- Specified by:
getMonetaryFormat
in classNetworkParameters
- Returns:
- formatting utility object
-
getUriScheme
public java.lang.String getUriScheme()
Description copied from class:NetworkParameters
Scheme part for URIs, for example "bitcoin".- Specified by:
getUriScheme
in classNetworkParameters
- Returns:
- a string with the "scheme" part
-
hasMaxMoney
public boolean hasMaxMoney()
Description copied from class:NetworkParameters
Returns whether this network has a maximum number of coins (finite supply) or not. Always returns true for Bitcoin, but exists to be overridden for other networks.- Specified by:
hasMaxMoney
in classNetworkParameters
- Returns:
- true if network has a fixed maximum number of coins
-
getSerializer
public BitcoinSerializer getSerializer()
Description copied from class:NetworkParameters
Construct and return a custom serializer.- Specified by:
getSerializer
in classNetworkParameters
- Returns:
- the serializer
-
getProtocolVersionNum
public int getProtocolVersionNum(NetworkParameters.ProtocolVersion version)
- Specified by:
getProtocolVersionNum
in classNetworkParameters
-
-