예제 #1
0
 public NetworkParameters get() {
   switch (this) {
     case MAIN:
     case PROD:
       return MainNetParams.get();
     case TEST:
       return TestNet3Params.get();
     case REGTEST:
     default:
       return RegTestParams.get();
   }
 }
 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;
   }
 }
  /**
   * 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();
 }