Java Code Examples for org.bitcoinj.core.NetworkParameters#equals()
The following examples show how to use
org.bitcoinj.core.NetworkParameters#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Networks.java From bcm-android with GNU General Public License v3.0 | 5 votes |
public static void unregister(NetworkParameters network) { if (networks.contains(network)) { ImmutableSet.Builder<NetworkParameters> builder = ImmutableSet.builder(); for (NetworkParameters parameters : networks) { if (parameters.equals(network)) continue; builder.add(parameters); } networks = builder.build(); } }
Example 2
Source File: Networks.java From bisq-core with GNU Affero General Public License v3.0 | 5 votes |
public static void unregister(NetworkParameters network) { if (networks.contains(network)) { ImmutableSet.Builder<NetworkParameters> builder = ImmutableSet.builder(); for (NetworkParameters parameters : networks) { if (parameters.equals(network)) continue; builder.add(parameters); } networks = builder.build(); } }
Example 3
Source File: Networks.java From green_android with GNU General Public License v3.0 | 5 votes |
public static void unregister(NetworkParameters network) { if (networks.contains(network)) { ImmutableSet.Builder<NetworkParameters> builder = ImmutableSet.builder(); for (NetworkParameters parameters : networks) { if (parameters.equals(network)) continue; builder.add(parameters); } networks = builder.build(); } }
Example 4
Source File: Networks.java From GreenBits with GNU General Public License v3.0 | 5 votes |
public static void unregister(NetworkParameters network) { if (networks.contains(network)) { ImmutableSet.Builder<NetworkParameters> builder = ImmutableSet.builder(); for (NetworkParameters parameters : networks) { if (parameters.equals(network)) continue; builder.add(parameters); } networks = builder.build(); } }
Example 5
Source File: WalletConfig.java From bisq-core with GNU Affero General Public License v3.0 | 4 votes |
public WalletConfig(NetworkParameters params, Socks5Proxy socks5Proxy, File directory, BisqEnvironment bisqEnvironment, String userAgent, int numConnectionForBtc, @SuppressWarnings("SameParameterValue") String btcWalletFileName, @SuppressWarnings("SameParameterValue") String bsqWalletFileName, @SuppressWarnings("SameParameterValue") String spvChainFileName) { this.bisqEnvironment = bisqEnvironment; this.userAgent = userAgent; this.numConnectionForBtc = numConnectionForBtc; this.context = new Context(params); this.params = checkNotNull(context.getParams()); this.directory = checkNotNull(directory); this.btcWalletFileName = checkNotNull(btcWalletFileName); this.bsqWalletFileName = bsqWalletFileName; this.spvChainFileName = spvChainFileName; this.socks5Proxy = socks5Proxy; walletFactory = new BisqWalletFactory() { @Override public Wallet create(NetworkParameters params, KeyChainGroup keyChainGroup) { // This is called when we load an existing wallet // We have already the chain here so we can use this to distinguish. List<DeterministicKeyChain> deterministicKeyChains = keyChainGroup.getDeterministicKeyChains(); if (!deterministicKeyChains.isEmpty() && deterministicKeyChains.get(0) instanceof BisqDeterministicKeyChain) { checkArgument(BisqEnvironment.isBaseCurrencySupportingBsq(), "BisqEnvironment.isBaseCurrencySupportingBsq() is false but we get get " + "called BisqWalletFactory.create with BisqDeterministicKeyChain"); return new BsqWallet(params, keyChainGroup); } else { return new Wallet(params, keyChainGroup); } } @Override public Wallet create(NetworkParameters params, KeyChainGroup keyChainGroup, boolean isBsqWallet) { // This is called at first startup when we create the wallet if (isBsqWallet) { checkArgument(BisqEnvironment.isBaseCurrencySupportingBsq(), "BisqEnvironment.isBaseCurrencySupportingBsq() is false but we get get " + "called BisqWalletFactory.create with isBsqWallet=true"); return new BsqWallet(params, keyChainGroup); } else { return new Wallet(params, keyChainGroup); } } }; String path = null; if (params.equals(MainNetParams.get())) { // Checkpoints are block headers that ship inside our app: for a new user, we pick the last header // in the checkpoints file and then download the rest from the network. It makes things much faster. // Checkpoint files are made using the BuildCheckpoints tool and usually we have to download the // last months worth or more (takes a few seconds). path = "/wallet/checkpoints"; } else if (params.equals(TestNet3Params.get())) { path = "/wallet/checkpoints.testnet"; } if (path != null) { try { setCheckpoints(getClass().getResourceAsStream(path)); } catch (Exception e) { e.printStackTrace(); log.error(e.toString()); } } }
Example 6
Source File: WalletConfig.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
public WalletConfig(NetworkParameters params, Socks5Proxy socks5Proxy, File directory, Config config, LocalBitcoinNode localBitcoinNode, String userAgent, int numConnectionsForBtc, @SuppressWarnings("SameParameterValue") String btcWalletFileName, @SuppressWarnings("SameParameterValue") String bsqWalletFileName, @SuppressWarnings("SameParameterValue") String spvChainFileName) { this.config = config; this.localBitcoinNode = localBitcoinNode; this.userAgent = userAgent; this.numConnectionsForBtc = numConnectionsForBtc; this.context = new Context(params); this.params = checkNotNull(context.getParams()); this.directory = checkDir(directory); this.btcWalletFileName = checkNotNull(btcWalletFileName); this.bsqWalletFileName = bsqWalletFileName; this.spvChainFileName = spvChainFileName; this.socks5Proxy = socks5Proxy; walletFactory = new BisqWalletFactory() { @Override public Wallet create(NetworkParameters params, KeyChainGroup keyChainGroup) { // This is called when we load an existing wallet // We have already the chain here so we can use this to distinguish. List<DeterministicKeyChain> deterministicKeyChains = keyChainGroup.getDeterministicKeyChains(); if (!deterministicKeyChains.isEmpty() && deterministicKeyChains.get(0) instanceof BisqDeterministicKeyChain) { return new BsqWallet(params, keyChainGroup); } else { return new Wallet(params, keyChainGroup); } } @Override public Wallet create(NetworkParameters params, KeyChainGroup keyChainGroup, boolean isBsqWallet) { // This is called at first startup when we create the wallet if (isBsqWallet) { return new BsqWallet(params, keyChainGroup); } else { return new Wallet(params, keyChainGroup); } } }; String path = null; if (params.equals(MainNetParams.get())) { // Checkpoints are block headers that ship inside our app: for a new user, we pick the last header // in the checkpoints file and then download the rest from the network. It makes things much faster. // Checkpoint files are made using the BuildCheckpoints tool and usually we have to download the // last months worth or more (takes a few seconds). path = "/wallet/checkpoints.txt"; } else if (params.equals(TestNet3Params.get())) { path = "/wallet/checkpoints.testnet.txt"; } if (path != null) { try { setCheckpoints(getClass().getResourceAsStream(path)); } catch (Exception e) { e.printStackTrace(); log.error(e.toString()); } } }