mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 13:37:24 +00:00
Global search and replace to use the param-class specific instance getters and prodNet -> MainNetParams.
The old "prodnet" name could be confusing to non-native speakers or people who just haven't been exposed to Google lingo. Main net is more idiomatic. Conflicts: tools/src/main/java/com/google/bitcoin/tools/BlockImporter.java
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.google.bitcoin.examples;
|
||||
|
||||
import com.google.bitcoin.core.*;
|
||||
import com.google.bitcoin.params.TestNet3Params;
|
||||
import com.google.bitcoin.store.BlockStore;
|
||||
import com.google.bitcoin.store.MemoryBlockStore;
|
||||
import com.google.bitcoin.utils.BriefLogFormatter;
|
||||
@@ -31,7 +32,7 @@ public class FetchBlock {
|
||||
public static void main(String[] args) throws Exception {
|
||||
BriefLogFormatter.init();
|
||||
System.out.println("Connecting to node");
|
||||
final NetworkParameters params = NetworkParameters.testNet();
|
||||
final NetworkParameters params = TestNet3Params.get();
|
||||
|
||||
BlockStore blockStore = new MemoryBlockStore(params);
|
||||
BlockChain chain = new BlockChain(params, blockStore);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.google.bitcoin.examples;
|
||||
|
||||
import com.google.bitcoin.core.*;
|
||||
import com.google.bitcoin.params.TestNet3Params;
|
||||
import com.google.bitcoin.store.BlockStore;
|
||||
import com.google.bitcoin.store.MemoryBlockStore;
|
||||
import com.google.bitcoin.utils.BriefLogFormatter;
|
||||
@@ -32,7 +33,7 @@ public class FetchTransactions {
|
||||
public static void main(String[] args) throws Exception {
|
||||
BriefLogFormatter.init();
|
||||
System.out.println("Connecting to node");
|
||||
final NetworkParameters params = NetworkParameters.testNet();
|
||||
final NetworkParameters params = TestNet3Params.get();
|
||||
|
||||
BlockStore blockStore = new MemoryBlockStore(params);
|
||||
BlockChain chain = new BlockChain(params, blockStore);
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.google.bitcoin.core.NetworkParameters;
|
||||
import com.google.bitcoin.core.Peer;
|
||||
import com.google.bitcoin.core.PeerGroup;
|
||||
import com.google.bitcoin.discovery.DnsDiscovery;
|
||||
import com.google.bitcoin.params.MainNetParams;
|
||||
import com.google.bitcoin.utils.BriefLogFormatter;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class PeerMonitor {
|
||||
}
|
||||
|
||||
private void setupNetwork() {
|
||||
params = NetworkParameters.prodNet();
|
||||
params = MainNetParams.get();
|
||||
peerGroup = new PeerGroup(params, null /* no chain */);
|
||||
peerGroup.setUserAgent("PeerMonitor", "1.0");
|
||||
peerGroup.setMaxConnections(4);
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.google.bitcoin.examples;
|
||||
import com.google.bitcoin.core.*;
|
||||
import com.google.bitcoin.crypto.KeyCrypterException;
|
||||
import com.google.bitcoin.discovery.DnsDiscovery;
|
||||
import com.google.bitcoin.params.MainNetParams;
|
||||
import com.google.bitcoin.params.TestNet3Params;
|
||||
import com.google.bitcoin.store.BlockStore;
|
||||
import com.google.bitcoin.store.SPVBlockStore;
|
||||
import com.google.bitcoin.utils.BriefLogFormatter;
|
||||
@@ -39,7 +41,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If running on TestNet (slow but better than using real coins on prodnet) do the following:
|
||||
* If running on TestNet (slow but better than using real coins on the main network) do the following:
|
||||
* <ol>
|
||||
* <li>Backup your current wallet.dat in case of unforeseen problems</li>
|
||||
* <li>Start your bitcoin client in test mode <code>bitcoin -testnet</code>. This will create a new sub-directory called testnet and should not interfere with normal wallets or operations.</li>
|
||||
@@ -67,8 +69,8 @@ public class PingService {
|
||||
|
||||
public PingService(String[] args) throws Exception {
|
||||
boolean testNet = args.length > 0 && args[0].equalsIgnoreCase("testnet");
|
||||
final NetworkParameters params = testNet ? NetworkParameters.testNet() : NetworkParameters.prodNet();
|
||||
String filePrefix = testNet ? "pingservice-testnet" : "pingservice-prodnet";
|
||||
final NetworkParameters params = testNet ? TestNet3Params.get() : MainNetParams.get();
|
||||
String filePrefix = testNet ? "pingservice-testnet" : "pingservice-mainnet";
|
||||
// Try to read the wallet from storage, create a new one if not possible.
|
||||
walletFile = new File(filePrefix + ".wallet");
|
||||
Wallet w;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.google.bitcoin.core.TCPNetworkConnection;
|
||||
import com.google.bitcoin.core.VersionMessage;
|
||||
import com.google.bitcoin.discovery.DnsDiscovery;
|
||||
import com.google.bitcoin.discovery.PeerDiscoveryException;
|
||||
import com.google.bitcoin.params.MainNetParams;
|
||||
import com.google.bitcoin.utils.BriefLogFormatter;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
@@ -53,7 +54,7 @@ public class PrintPeers {
|
||||
|
||||
private static void printDNS() throws PeerDiscoveryException {
|
||||
long start = System.currentTimeMillis();
|
||||
DnsDiscovery dns = new DnsDiscovery(NetworkParameters.prodNet());
|
||||
DnsDiscovery dns = new DnsDiscovery(MainNetParams.get());
|
||||
dnsPeers = dns.getPeers(10, TimeUnit.SECONDS);
|
||||
printPeers(dnsPeers);
|
||||
printElapsed(start);
|
||||
@@ -69,7 +70,7 @@ public class PrintPeers {
|
||||
for (InetSocketAddress peer : dnsPeers) addrs.add(peer.getAddress());
|
||||
System.out.println("Scanning " + addrs.size() + " peers:");
|
||||
|
||||
final NetworkParameters params = NetworkParameters.prodNet();
|
||||
final NetworkParameters params = MainNetParams.get();
|
||||
final Object lock = new Object();
|
||||
final long[] bestHeight = new long[1];
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.google.bitcoin.examples;
|
||||
|
||||
import com.google.bitcoin.core.*;
|
||||
import com.google.bitcoin.params.MainNetParams;
|
||||
import com.google.bitcoin.store.MemoryBlockStore;
|
||||
|
||||
import java.math.BigInteger;
|
||||
@@ -33,8 +34,8 @@ import java.net.InetAddress;
|
||||
*/
|
||||
public class PrivateKeys {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// TODO: Assumes production network not testnet. Make it selectable.
|
||||
NetworkParameters params = NetworkParameters.prodNet();
|
||||
// TODO: Assumes main network not testnet. Make it selectable.
|
||||
NetworkParameters params = MainNetParams.get();
|
||||
try {
|
||||
// Decode the private key from Satoshis Base58 variant. If 51 characters long then it's from Bitcoins
|
||||
// dumpprivkey command and includes a version byte and checksum. Otherwise assume it's a raw key.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.google.bitcoin.examples;
|
||||
|
||||
import com.google.bitcoin.core.*;
|
||||
import com.google.bitcoin.params.TestNet3Params;
|
||||
import com.google.bitcoin.store.BlockStore;
|
||||
import com.google.bitcoin.store.MemoryBlockStore;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class RefreshWallet {
|
||||
System.out.println(wallet.toString());
|
||||
|
||||
// Set up the components and link them together.
|
||||
final NetworkParameters params = NetworkParameters.testNet();
|
||||
final NetworkParameters params = TestNet3Params.get();
|
||||
BlockStore blockStore = new MemoryBlockStore(params);
|
||||
BlockChain chain = new BlockChain(params, wallet, blockStore);
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.google.bitcoin.examples.toywallet;
|
||||
|
||||
import com.google.bitcoin.core.*;
|
||||
import com.google.bitcoin.discovery.DnsDiscovery;
|
||||
import com.google.bitcoin.params.MainNetParams;
|
||||
import com.google.bitcoin.params.TestNet3Params;
|
||||
import com.google.bitcoin.store.H2FullPrunedBlockStore;
|
||||
import com.google.bitcoin.store.SPVBlockStore;
|
||||
import com.google.bitcoin.utils.BriefLogFormatter;
|
||||
@@ -113,9 +115,9 @@ public class ToyWallet {
|
||||
public ToyWallet(boolean testnet, boolean fullChain, String[] args) throws Exception {
|
||||
// Set up a Bitcoin connection + empty wallet. TODO: Simplify the setup for this use case.
|
||||
if (testnet) {
|
||||
params = NetworkParameters.testNet();
|
||||
params = TestNet3Params.get();
|
||||
} else {
|
||||
params = NetworkParameters.prodNet();
|
||||
params = MainNetParams.get();
|
||||
}
|
||||
|
||||
// Try to read the wallet from storage, create a new one if not possible.
|
||||
|
||||
Reference in New Issue
Block a user