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:
parent
51c10a3857
commit
e67b3e540e
@ -601,7 +601,7 @@ public class Peer {
|
|||||||
final ListenableFuture future = downloadDependenciesInternal(tx, new Object(), results);
|
final ListenableFuture future = downloadDependenciesInternal(tx, new Object(), results);
|
||||||
final SettableFuture<List<Transaction>> resultFuture = SettableFuture.create();
|
final SettableFuture<List<Transaction>> resultFuture = SettableFuture.create();
|
||||||
Futures.addCallback(future, new FutureCallback() {
|
Futures.addCallback(future, new FutureCallback() {
|
||||||
public void onSuccess(Object _) {
|
public void onSuccess(Object ignored) {
|
||||||
resultFuture.set(results);
|
resultFuture.set(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1290,7 +1290,7 @@ public class PeerGroup extends AbstractIdleService implements TransactionBroadca
|
|||||||
// any peer discovery source and the user just calls connectTo() once.
|
// any peer discovery source and the user just calls connectTo() once.
|
||||||
if (minConnections == 1) {
|
if (minConnections == 1) {
|
||||||
sendComplete.addListener(new ChannelFutureListener() {
|
sendComplete.addListener(new ChannelFutureListener() {
|
||||||
public void operationComplete(ChannelFuture _) throws Exception {
|
public void operationComplete(ChannelFuture operation) throws Exception {
|
||||||
for (Wallet wallet : wallets) {
|
for (Wallet wallet : wallets) {
|
||||||
try {
|
try {
|
||||||
// Assumption here is there are no dependencies of the created transaction.
|
// Assumption here is there are no dependencies of the created transaction.
|
||||||
|
@ -836,7 +836,7 @@ public class PeerTest extends TestWithNetworkConnections {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
ServerSocket server = new ServerSocket(0);
|
ServerSocket server = new ServerSocket(0);
|
||||||
final NetworkParameters params = TestNet3Params.testNet();
|
final NetworkParameters params = TestNet3Params.get();
|
||||||
Peer peer = new Peer(params, blockChain, "test", "1.0");
|
Peer peer = new Peer(params, blockChain, "test", "1.0");
|
||||||
ListenableFuture<TCPNetworkConnection> future = TCPNetworkConnection.connectTo(TestNet3Params.get(),
|
ListenableFuture<TCPNetworkConnection> future = TCPNetworkConnection.connectTo(TestNet3Params.get(),
|
||||||
new InetSocketAddress(InetAddress.getLocalHost(), server.getLocalPort()), 5000, peer);
|
new InetSocketAddress(InetAddress.getLocalHost(), server.getLocalPort()), 5000, peer);
|
||||||
|
@ -22,9 +22,7 @@ import org.junit.Test;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.*;
|
import static com.google.bitcoin.core.Utils.*;
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
import static junit.framework.Assert.fail;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
public class UtilsTest {
|
public class UtilsTest {
|
||||||
|
|
||||||
|
@ -1,49 +1,33 @@
|
|||||||
package com.google.bitcoin.tools;
|
package com.google.bitcoin.tools;
|
||||||
|
|
||||||
import java.io.File;
|
import com.google.bitcoin.core.*;
|
||||||
|
|
||||||
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.params.MainNetParams;
|
import com.google.bitcoin.params.MainNetParams;
|
||||||
import com.google.bitcoin.params.TestNet3Params;
|
import com.google.bitcoin.params.TestNet3Params;
|
||||||
import com.google.bitcoin.store.BlockStore;
|
import com.google.bitcoin.store.*;
|
||||||
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.utils.BlockFileLoader;
|
import com.google.bitcoin.utils.BlockFileLoader;
|
||||||
import com.google.common.base.Preconditions;
|
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 class BlockImporter {
|
||||||
public static void main(String[] args) throws BlockStoreException, VerificationException, PrunedException {
|
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(" blockStore is required unless type is Mem or MemFull");
|
||||||
System.out.println(" eg BlockImporter prod H2 /home/user/bitcoinj.h2store");
|
System.out.println(" eg BlockImporter prod H2 /home/user/bitcoinj.h2store");
|
||||||
System.out.println(" Does full verification if the store supports it");
|
System.out.println(" Does full verification if the store supports it");
|
||||||
Preconditions.checkArgument(args.length == 2 || args.length == 3);
|
Preconditions.checkArgument(args.length == 2 || args.length == 3);
|
||||||
|
|
||||||
NetworkParameters params = null;
|
NetworkParameters params;
|
||||||
if (args[0].equals("test"))
|
if (args[0].equals("test"))
|
||||||
params = TestNet3Params.get();
|
params = TestNet3Params.get();
|
||||||
else
|
else
|
||||||
params = MainNetParams.get();
|
params = MainNetParams.get();
|
||||||
|
|
||||||
BlockStore store = null;
|
BlockStore store;
|
||||||
if (args[1].equals("H2")) {
|
if (args[1].equals("H2")) {
|
||||||
Preconditions.checkArgument(args.length == 3);
|
Preconditions.checkArgument(args.length == 3);
|
||||||
store = new H2FullPrunedBlockStore(params, args[2], 100);
|
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")) {
|
} else if (args[1].equals("MemFull")) {
|
||||||
Preconditions.checkArgument(args.length == 2);
|
Preconditions.checkArgument(args.length == 2);
|
||||||
store = new MemoryFullPrunedBlockStore(params, 100);
|
store = new MemoryFullPrunedBlockStore(params, 100);
|
||||||
@ -53,6 +37,9 @@ public class BlockImporter {
|
|||||||
} else if (args[1].equals("SPV")) {
|
} else if (args[1].equals("SPV")) {
|
||||||
Preconditions.checkArgument(args.length == 3);
|
Preconditions.checkArgument(args.length == 3);
|
||||||
store = new SPVBlockStore(params, new File(args[2]));
|
store = new SPVBlockStore(params, new File(args[2]));
|
||||||
|
} else {
|
||||||
|
System.err.println("Unknown store " + args[1]);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractBlockChain chain = null;
|
AbstractBlockChain chain = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user