@Override public boolean equals(ValueType obj) { return super.equals(obj); }
@Override public boolean equals(ValueType obj) { return super.equals(obj); }
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(); } } }
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(); } } }
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(); } } }
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(); } } }
public SigningKeyImpl(String s, NetworkParameters params) throws AddressFormatException { this(s); if (!this.params.equals(params)) { throw new AddressFormatException("Wrong network."); } }
public Btcd(NetworkParameters netParams, String rpcuser, String rpcpass) throws MalformedURLException { super(netParams, 0); this.rpcuser = rpcuser; this.rpcpass = rpcpass; if (netParams.equals(NetworkParameters.fromID(NetworkParameters.ID_MAINNET))) { url = new URL("http://127.0.0.1:8334"); } else if (netParams.equals(NetworkParameters.fromID(NetworkParameters.ID_TESTNET))) { url = new URL("http://127.0.0.1:18334"); } else { throw new IllegalArgumentException("Invalid network parameters passed to btcd. "); } }
/** * Set the {@link UTXOProvider}. * * <p>The wallet will query the provider for spendable candidates, i.e. outputs controlled exclusively * by private keys contained in the wallet.</p> * * <p>Note that the associated provider must be reattached after a wallet is loaded from disk. * The association is not serialized.</p> */ public void setUTXOProvider(@Nullable UTXOProvider provider) { lock.lock(); try { checkArgument(provider == null || provider.getParams().equals(params)); this.vUTXOProvider = provider; } finally { lock.unlock(); } }
/** * Set the {@link UTXOProvider}. * * <p>The wallet will query the provider for spendable candidates, i.e. outputs controlled exclusively * by private keys contained in the wallet.</p> * * <p>Note that the associated provider must be reattached after a wallet is loaded from disk. * The association is not serialized.</p> */ public void setUTXOProvider(@Nullable UTXOProvider provider) { lock.lock(); try { checkArgument(provider == null || provider.getParams().equals(params)); this.vUTXOProvider = provider; } finally { lock.unlock(); } }
/** * Set the {@link UTXOProvider}. * * <p>The wallet will query the provider for spendable candidates, i.e. outputs controlled exclusively * by private keys contained in the wallet.</p> * * <p>Note that the associated provider must be reattached after a wallet is loaded from disk. * The association is not serialized.</p> */ public void setUTXOProvider(@Nullable UTXOProvider provider) { lock.lock(); try { checkArgument(provider == null || provider.getParams().equals(params)); this.vUTXOProvider = provider; } finally { lock.unlock(); } }
/** * Set the {@link UTXOProvider}. * * <p>The wallet will query the provider for spendable candidates, i.e. outputs controlled exclusively * by private keys contained in the wallet.</p> * * <p>Note that the associated provider must be reattached after a wallet is loaded from disk. * The association is not serialized.</p> */ public void setUTXOProvider(@Nullable UTXOProvider provider) { lock.lock(); try { checkArgument(provider == null || provider.getParams().equals(params)); this.vUTXOProvider = provider; } finally { lock.unlock(); } }
@Bean public BlockChain bitcoinBlockchain(SPVBlockStore blockStore, Context bitcoinContext, NetworkParameters chainNetworkParameters) throws IOException, BlockStoreException { if (chainNetworkParameters.equals(MainNetParams.get())) { InputStream checkPoints = BitcoinMonitor.class.getClassLoader().getResourceAsStream("checkpoints.txt"); CheckpointManager.checkpoint(chainNetworkParameters, checkPoints, blockStore, 1498867200L); } else if (chainNetworkParameters.equals(TestNet3Params.get())) { InputStream checkPoints = BitcoinMonitor.class.getClassLoader().getResourceAsStream("checkpoints-testnet.txt"); CheckpointManager.checkpoint(chainNetworkParameters, checkPoints, blockStore, 1498867200L); } return new BlockChain(bitcoinContext, blockStore); }
@Bean public PeerGroup peerGroup(BlockChain bitcoinBlockchain, Context bitcoinContext, NetworkParameters chainNetworkParameters) { PeerGroup peerGroup = new PeerGroup(bitcoinContext, bitcoinBlockchain); // Regtest has no peer-to-peer functionality if (chainNetworkParameters.equals(MainNetParams.get())) { Stream.of(appConfig.getBitcoinNodePeerGroupSeed()) .forEach((peer) -> { try { peerGroup.addAddress(Inet4Address.getByName(peer)); } catch (UnknownHostException e) { LOG.error("Not possible to add peer {} to the peer group. Unknown error: {}", peer, e); } }); } else if (chainNetworkParameters.equals(TestNet3Params.get())) { peerGroup.addPeerDiscovery(new DnsDiscovery(chainNetworkParameters)); } return peerGroup; }
/** * Generates a Payment message based on the information in the PaymentRequest. * Provide transactions built by the wallet. * If the PaymentRequest did not specify a payment_url, returns null. * @param txns list of transactions to be included with the Payment message. * @param refundAddr will be used by the merchant to send money back if there was a problem. * @param memo is a message to include in the payment message sent to the merchant. */ @Nullable public Protos.Payment getPayment(List<Transaction> txns, @Nullable Address refundAddr, @Nullable String memo) throws IOException, PaymentProtocolException.InvalidNetwork { if (paymentDetails.hasPaymentUrl()) { for (Transaction tx : txns) { // BIP70 doesn't allow for regtest in its network type. If we mismatch, // treat regtest transactions for a testnet payment request as a match. if (!tx.getParams().equals(params) && (!tx.getParams().equals(RegTestParams.get()) || !params.equals(TestNet3Params.get()))) throw new PaymentProtocolException.InvalidNetwork(params.getPaymentProtocolId()); } return PaymentProtocol.createPaymentMessage(txns, totalValue, refundAddr, memo, getMerchantData()); } else { return null; } }
/** * Generates a Payment message based on the information in the PaymentRequest. * Provide transactions built by the wallet. * If the PaymentRequest did not specify a payment_url, returns null. * @param txns list of transactions to be included with the Payment message. * @param refundAddr will be used by the merchant to send money back if there was a problem. * @param memo is a message to include in the payment message sent to the merchant. */ @Nullable public Protos.Payment getPayment(List<Transaction> txns, @Nullable Address refundAddr, @Nullable String memo) throws IOException, PaymentProtocolException.InvalidNetwork { if (paymentDetails.hasPaymentUrl()) { for (Transaction tx : txns) if (!tx.getParams().equals(params)) throw new PaymentProtocolException.InvalidNetwork(params.getPaymentProtocolId()); return PaymentProtocol.createPaymentMessage(txns, totalValue, refundAddr, memo, getMerchantData()); } else { return null; } }
/** * Generates a Payment message based on the information in the PaymentRequest. * Provide transactions built by the wallet. * If the PaymentRequest did not specify a payment_url, returns null. * @param txns list of transactions to be included with the Payment message. * @param refundAddr will be used by the merchant to send money back if there was a problem. * @param memo is a message to include in the payment message sent to the merchant. */ public @Nullable Protos.Payment getPayment(List<Transaction> txns, @Nullable Address refundAddr, @Nullable String memo) throws IOException, PaymentProtocolException.InvalidNetwork { if (paymentDetails.hasPaymentUrl()) { for (Transaction tx : txns) if (!tx.getParams().equals(params)) throw new PaymentProtocolException.InvalidNetwork(params.getPaymentProtocolId()); return PaymentProtocol.createPaymentMessage(txns, totalValue, refundAddr, memo, getMerchantData()); } else { return null; } }
/** * Generates a Payment message based on the information in the PaymentRequest. * Provide transactions built by the wallet. * If the PaymentRequest did not specify a payment_url, returns null. * @param txns list of transactions to be included with the Payment message. * @param refundAddr will be used by the merchant to send money back if there was a problem. * @param memo is a message to include in the payment message sent to the merchant. */ @Nullable public Protos.Payment getPayment(List<Transaction> txns, @Nullable Address refundAddr, @Nullable String memo) throws IOException, PaymentProtocolException.InvalidNetwork { if (paymentDetails.hasPaymentUrl()) { for (Transaction tx : txns) if (!tx.getParams().equals(params)) throw new PaymentProtocolException.InvalidNetwork(params.getPaymentProtocolId()); return PaymentProtocol.createPaymentMessage(txns, totalValue, refundAddr, memo, getMerchantData()); } else { return null; } }
/** * Generates a Payment message based on the information in the PaymentRequest. * Provide transactions built by the wallet. * If the PaymentRequest did not specify a payment_url, returns null. * @param txns list of transactions to be included with the Payment message. * @param refundAddr will be used by the merchant to send money back if there was a problem. * @param memo is a message to include in the payment message sent to the merchant. */ @Nullable public Protos.Payment getPayment(List<Transaction> txns, @Nullable Address refundAddr, @Nullable String memo) throws IOException, PaymentProtocolException.InvalidNetwork { if (paymentDetails.hasPaymentUrl()) { for (Transaction tx : txns) if (!tx.getParams().equals(params)) throw new PaymentProtocolException.InvalidNetwork(params.getPaymentProtocolId()); return PaymentProtocol.createPaymentMessage(txns, totalValue, refundAddr, memo, getMerchantData()); } else { return null; } }
walletInputStream = new BufferedInputStream(new FileInputStream(walletFile)); wallet = loader.readWallet(walletInputStream, forceReset, (WalletExtension[])(null)); if (!wallet.getParams().equals(params)) { System.err.println("Wallet does not match requested network parameters: " + wallet.getParams().getId() + " vs " + params.getId());