コード例 #1
0
ファイル: NetworkEnum.java プロジェクト: Fermat-ORG/bitcoinj
 public NetworkParameters get() {
   switch (this) {
     case MAIN:
     case PROD:
       return MainNetParams.get();
     case TEST:
       return TestNet3Params.get();
     case REGTEST:
     default:
       return RegTestParams.get();
   }
 }
コード例 #2
0
 public static NetworkParameters getNetworkParameter(BlockchainNetworkType blockchainNetworkType) {
   switch (blockchainNetworkType) {
     case PRODUCTION:
       return MainNetParams.get();
     case TEST_NET:
       return TestNet3Params.get();
     case REG_TEST:
       return RegTestParams.get();
     default:
       return getNetworkParameter(BitcoinNetworkConfiguration.DEFAULT_NETWORK_TYPE);
   }
 }
コード例 #3
0
 /** Returns the network parameters for the given string ID or NULL if not recognized. */
 @Nullable
 public static NetworkParameters fromID(String id) {
   if (id.equals(ID_MAINNET)) {
     return MainNetParams.get();
   } else if (id.equals(ID_TESTNET)) {
     return TestNet3Params.get();
   } else if (id.equals(ID_UNITTESTNET)) {
     return UnitTestParams.get();
   } else if (id.equals(ID_REGTEST)) {
     return RegTestParams.get();
   } else {
     return null;
   }
 }
コード例 #4
0
  /**
   * Gets the correct BlockchainNetworkType based in the passed NetworkParameters
   *
   * @param networkParameters
   * @return
   */
  public static BlockchainNetworkType getBlockchainNetworkType(
      NetworkParameters networkParameters) {
    /** I will return the correct network type. */
    BlockchainNetworkType blockchainNetworkType = null;
    if (networkParameters == RegTestParams.get()) {
      blockchainNetworkType = BlockchainNetworkType.REG_TEST;
    } else if (networkParameters == MainNetParams.get()) {
      blockchainNetworkType = BlockchainNetworkType.PRODUCTION;
    } else if (networkParameters == TestNet3Params.get()) {
      blockchainNetworkType = BlockchainNetworkType.TEST_NET;
    }

    return blockchainNetworkType;
  }
コード例 #5
0
 /** Returns a standard regression test params (similar to unitTests) */
 @Deprecated
 public static NetworkParameters regTests() {
   return RegTestParams.get();
 }