Package org.bitcoinj.testing
Class MockAltNetworkParams
java.lang.Object
org.bitcoinj.core.NetworkParameters
org.bitcoinj.testing.MockAltNetworkParams
Mock Alt-net subclass of
NetworkParameters for unit tests.-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckDifficultyTransitions(StoredBlock storedPrev, Block next, BlockStore blockStore) Throws an exception if the block's difficulty is not correct.Genesis block for this chain.Returns the number of coins that will be produced in total, on this network.The monetary object for this currency.Construct and return a custom serializer.Scheme part for URIs, for example "bitcoin".booleanReturns 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, getProtocolVersionNum, getSegwitAddressHrp, getSpendableCoinbaseDepth, getSubsidyDecreaseBlockCount, getTargetTimespan, getTransactionVerificationFlags, hashCode, isCheckpoint, network, of, passesCheckpoint
-
Field Details
-
MOCKNET_GOOD_ADDRESS
- See Also:
-
-
Constructor Details
-
MockAltNetworkParams
public MockAltNetworkParams()
-
-
Method Details
-
getPaymentProtocolId
- Specified by:
getPaymentProtocolIdin 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:NetworkParametersThrows an exception if the block's difficulty is not correct.- Specified by:
checkDifficultyTransitionsin 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
Description copied from class:NetworkParametersGenesis 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:
getGenesisBlockin classNetworkParameters- Returns:
- genesis block
-
getMaxMoney
Description copied from class:NetworkParametersReturns 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:
getMaxMoneyin classNetworkParameters- Returns:
- maximum number of coins for this network
-
getMonetaryFormat
Description copied from class:NetworkParametersThe monetary object for this currency.- Specified by:
getMonetaryFormatin classNetworkParameters- Returns:
- formatting utility object
-
getUriScheme
Description copied from class:NetworkParametersScheme part for URIs, for example "bitcoin".- Specified by:
getUriSchemein classNetworkParameters- Returns:
- a string with the "scheme" part
-
hasMaxMoney
public boolean hasMaxMoney()Description copied from class:NetworkParametersReturns 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:
hasMaxMoneyin classNetworkParameters- Returns:
- true if network has a fixed maximum number of coins
-
getSerializer
Description copied from class:NetworkParametersConstruct and return a custom serializer.- Specified by:
getSerializerin classNetworkParameters- Returns:
- the serializer
-