3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 15:22:16 +00:00

Remove usage of some deprecated stuff.

This commit is contained in:
Mike Hearn 2013-09-20 18:03:30 +02:00
parent 51c10a3857
commit e67b3e540e
5 changed files with 15 additions and 30 deletions

View File

@ -601,7 +601,7 @@ public class Peer {
final ListenableFuture future = downloadDependenciesInternal(tx, new Object(), results);
final SettableFuture<List<Transaction>> resultFuture = SettableFuture.create();
Futures.addCallback(future, new FutureCallback() {
public void onSuccess(Object _) {
public void onSuccess(Object ignored) {
resultFuture.set(results);
}

View File

@ -1290,7 +1290,7 @@ public class PeerGroup extends AbstractIdleService implements TransactionBroadca
// any peer discovery source and the user just calls connectTo() once.
if (minConnections == 1) {
sendComplete.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture _) throws Exception {
public void operationComplete(ChannelFuture operation) throws Exception {
for (Wallet wallet : wallets) {
try {
// Assumption here is there are no dependencies of the created transaction.

View File

@ -836,7 +836,7 @@ public class PeerTest extends TestWithNetworkConnections {
}
};
ServerSocket server = new ServerSocket(0);
final NetworkParameters params = TestNet3Params.testNet();
final NetworkParameters params = TestNet3Params.get();
Peer peer = new Peer(params, blockChain, "test", "1.0");
ListenableFuture<TCPNetworkConnection> future = TCPNetworkConnection.connectTo(TestNet3Params.get(),
new InetSocketAddress(InetAddress.getLocalHost(), server.getLocalPort()), 5000, peer);

View File

@ -22,9 +22,7 @@ import org.junit.Test;
import java.math.BigInteger;
import static com.google.bitcoin.core.Utils.*;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.fail;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
public class UtilsTest {

View File

@ -1,49 +1,33 @@
package com.google.bitcoin.tools;
import java.io.File;
import com.google.bitcoin.core.AbstractBlockChain;
import com.google.bitcoin.core.Block;
import com.google.bitcoin.core.BlockChain;
import com.google.bitcoin.core.FullPrunedBlockChain;
import com.google.bitcoin.core.NetworkParameters;
import com.google.bitcoin.core.PrunedException;
import com.google.bitcoin.core.VerificationException;
import com.google.bitcoin.core.*;
import com.google.bitcoin.params.MainNetParams;
import com.google.bitcoin.params.TestNet3Params;
import com.google.bitcoin.store.BlockStore;
import com.google.bitcoin.store.BlockStoreException;
import com.google.bitcoin.store.BoundedOverheadBlockStore;
import com.google.bitcoin.store.FullPrunedBlockStore;
import com.google.bitcoin.store.H2FullPrunedBlockStore;
import com.google.bitcoin.store.MemoryBlockStore;
import com.google.bitcoin.store.MemoryFullPrunedBlockStore;
import com.google.bitcoin.store.SPVBlockStore;
import com.google.bitcoin.store.*;
import com.google.bitcoin.utils.BlockFileLoader;
import com.google.common.base.Preconditions;
/** Very thin wrapper around {@link com.google.bitcoin.util.BlockFileLoader} */
import java.io.File;
/** Very thin wrapper around {@link com.google.bitcoin.utils.BlockFileLoader} */
public class BlockImporter {
public static void main(String[] args) throws BlockStoreException, VerificationException, PrunedException {
System.out.println("USAGE: BlockImporter (prod|test) (H2|BoundedOverhead|Disk|MemFull|Mem|SPV) [blockStore]");
System.out.println("USAGE: BlockImporter (prod|test) (H2|Disk|MemFull|Mem|SPV) [blockStore]");
System.out.println(" blockStore is required unless type is Mem or MemFull");
System.out.println(" eg BlockImporter prod H2 /home/user/bitcoinj.h2store");
System.out.println(" Does full verification if the store supports it");
Preconditions.checkArgument(args.length == 2 || args.length == 3);
NetworkParameters params = null;
NetworkParameters params;
if (args[0].equals("test"))
params = TestNet3Params.get();
else
params = MainNetParams.get();
BlockStore store = null;
BlockStore store;
if (args[1].equals("H2")) {
Preconditions.checkArgument(args.length == 3);
store = new H2FullPrunedBlockStore(params, args[2], 100);
} else if (args[1].equals("BoundedOverhead")) {
Preconditions.checkArgument(args.length == 3);
store = new BoundedOverheadBlockStore(params, new File(args[2]));
} else if (args[1].equals("MemFull")) {
Preconditions.checkArgument(args.length == 2);
store = new MemoryFullPrunedBlockStore(params, 100);
@ -53,6 +37,9 @@ public class BlockImporter {
} else if (args[1].equals("SPV")) {
Preconditions.checkArgument(args.length == 3);
store = new SPVBlockStore(params, new File(args[2]));
} else {
System.err.println("Unknown store " + args[1]);
return;
}
AbstractBlockChain chain = null;