mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-01 12:31:23 +00:00
Convert to local variables.
This commit is contained in:
committed by
Andreas Schildbach
parent
dbda2b9280
commit
a1c0e00c5f
@@ -15,7 +15,6 @@ public class AddressMessage extends Message {
|
||||
private static final long serialVersionUID = 8058283864924679460L;
|
||||
private static final long MAX_ADDRESSES = 1024;
|
||||
private List<PeerAddress> addresses;
|
||||
private transient long numAddresses = -1;
|
||||
|
||||
/**
|
||||
* Contruct a new 'addr' message.
|
||||
@@ -62,7 +61,7 @@ public class AddressMessage extends Message {
|
||||
|
||||
@Override
|
||||
void parse() throws ProtocolException {
|
||||
numAddresses = readVarInt();
|
||||
long numAddresses = readVarInt();
|
||||
// Guard against ultra large messages that will crash us.
|
||||
if (numAddresses > MAX_ADDRESSES)
|
||||
throw new ProtocolException("Address message too large.");
|
||||
|
@@ -44,9 +44,7 @@ public class AlertMessage extends Message {
|
||||
private Date expiration;
|
||||
private long id;
|
||||
private long cancel;
|
||||
private Set<Long> cancelSet;
|
||||
private long minVer, maxVer;
|
||||
private Set<String> matchingSubVers;
|
||||
private long priority;
|
||||
private String comment, statusBar, reserved;
|
||||
|
||||
@@ -86,7 +84,7 @@ public class AlertMessage extends Message {
|
||||
}
|
||||
// Using a hashset here is very inefficient given that this will normally be only one item. But Java doesn't
|
||||
// make it easy to do better. What we really want is just an array-backed set.
|
||||
cancelSet = new HashSet<Long>((int)cancelSetSize);
|
||||
Set<Long> cancelSet = new HashSet<Long>((int) cancelSetSize);
|
||||
for (long i = 0; i < cancelSetSize; i++) {
|
||||
cancelSet.add(readUint32());
|
||||
}
|
||||
@@ -97,7 +95,7 @@ public class AlertMessage extends Message {
|
||||
if (subverSetSize < 0 || subverSetSize > MAX_SET_SIZE) {
|
||||
throw new ProtocolException("Bad subver set size: " + subverSetSize);
|
||||
}
|
||||
matchingSubVers = new HashSet<String>((int)subverSetSize);
|
||||
Set<String> matchingSubVers = new HashSet<String>((int) subverSetSize);
|
||||
for (long i = 0; i < subverSetSize; i++) {
|
||||
matchingSubVers.add(readStr());
|
||||
}
|
||||
|
@@ -67,7 +67,6 @@ import java.util.concurrent.Callable;
|
||||
public class PaymentSession {
|
||||
private static ListeningExecutorService executor = Threading.THREAD_POOL;
|
||||
private NetworkParameters params;
|
||||
private final TrustStoreLoader trustStoreLoader;
|
||||
private Protos.PaymentRequest paymentRequest;
|
||||
private Protos.PaymentDetails paymentDetails;
|
||||
private Coin totalValue = Coin.ZERO;
|
||||
@@ -202,11 +201,11 @@ public class PaymentSession {
|
||||
* If trustStoreLoader is null, the system default trust store is used.
|
||||
*/
|
||||
public PaymentSession(Protos.PaymentRequest request, boolean verifyPki, @Nullable final TrustStoreLoader trustStoreLoader) throws PaymentProtocolException {
|
||||
this.trustStoreLoader = trustStoreLoader != null ? trustStoreLoader : new TrustStoreLoader.DefaultTrustStoreLoader();
|
||||
TrustStoreLoader nonNullTrustStoreLoader = trustStoreLoader != null ? trustStoreLoader : new TrustStoreLoader.DefaultTrustStoreLoader();
|
||||
parsePaymentRequest(request);
|
||||
if (verifyPki) {
|
||||
try {
|
||||
pkiVerificationData = PaymentProtocol.verifyPaymentRequestPki(request, this.trustStoreLoader.getKeyStore());
|
||||
pkiVerificationData = PaymentProtocol.verifyPaymentRequestPki(request, nonNullTrustStoreLoader.getKeyStore());
|
||||
} catch (IOException x) {
|
||||
throw new PaymentProtocolException(x);
|
||||
} catch (KeyStoreException x) {
|
||||
|
@@ -49,7 +49,6 @@ public class BitcoindComparisonTool {
|
||||
private static final Logger log = LoggerFactory.getLogger(BitcoindComparisonTool.class);
|
||||
|
||||
private static NetworkParameters params;
|
||||
private static FullPrunedBlockStore store;
|
||||
private static FullPrunedBlockChain chain;
|
||||
private static Sha256Hash bitcoindChainHead;
|
||||
private static volatile InventoryMessage mostRecentInv = null;
|
||||
@@ -74,8 +73,8 @@ public class BitcoindComparisonTool {
|
||||
final Iterator<Block> blocks = new BlockFileLoader(params, Arrays.asList(blockFile));
|
||||
|
||||
try {
|
||||
store = new H2FullPrunedBlockStore(params, args.length > 0 ? args[0] : "BitcoindComparisonTool", blockList.maximumReorgBlockCount);
|
||||
((H2FullPrunedBlockStore)store).resetStore();
|
||||
H2FullPrunedBlockStore store = new H2FullPrunedBlockStore(params, args.length > 0 ? args[0] : "BitcoindComparisonTool", blockList.maximumReorgBlockCount);
|
||||
store.resetStore();
|
||||
//store = new MemoryFullPrunedBlockStore(params, blockList.maximumReorgBlockCount);
|
||||
chain = new FullPrunedBlockChain(params, store);
|
||||
} catch (BlockStoreException e) {
|
||||
|
@@ -50,8 +50,6 @@ public class ChainSplitTest {
|
||||
private Address coinsTo;
|
||||
private Address coinsTo2;
|
||||
private Address someOtherGuy;
|
||||
private MemoryBlockStore blockStore;
|
||||
private Context context;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -59,8 +57,8 @@ public class ChainSplitTest {
|
||||
Utils.setMockClock(); // Use mock clock
|
||||
Wallet.SendRequest.DEFAULT_FEE_PER_KB = Coin.ZERO;
|
||||
unitTestParams = UnitTestParams.get();
|
||||
context = new Context(unitTestParams);
|
||||
blockStore = new MemoryBlockStore(unitTestParams);
|
||||
Context context = new Context(unitTestParams);
|
||||
MemoryBlockStore blockStore = new MemoryBlockStore(unitTestParams);
|
||||
wallet = new Wallet(context);
|
||||
ECKey key1 = wallet.freshReceiveKey();
|
||||
ECKey key2 = wallet.freshReceiveKey();
|
||||
|
@@ -58,8 +58,6 @@ import static org.junit.Assert.*;
|
||||
public class ECKeyTest {
|
||||
private static final Logger log = LoggerFactory.getLogger(ECKeyTest.class);
|
||||
|
||||
private SecureRandom secureRandom;
|
||||
|
||||
private KeyCrypter keyCrypter;
|
||||
|
||||
private static CharSequence PASSWORD1 = "my hovercraft has eels";
|
||||
@@ -67,7 +65,7 @@ public class ECKeyTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
secureRandom = new SecureRandom();
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
byte[] salt = new byte[KeyCrypterScrypt.SALT_LENGTH];
|
||||
secureRandom.nextBytes(salt);
|
||||
|
@@ -62,8 +62,6 @@ public class LazyParseByteCacheTest {
|
||||
"00 8b 48 30 45 02 21 00 f3 58 1e 19 72 ae 8a c7" +
|
||||
"c7 36 7a 7a 25 3b c1 13 52 23 ad b9 a4 68 bb 3a");
|
||||
|
||||
private Context context;
|
||||
private Wallet wallet;
|
||||
private BlockStore blockStore;
|
||||
private NetworkParameters unitTestParams;
|
||||
|
||||
@@ -83,8 +81,8 @@ public class LazyParseByteCacheTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
unitTestParams = UnitTestParams.get();
|
||||
context = new Context(unitTestParams);
|
||||
wallet = new Wallet(context);
|
||||
Context context = new Context(unitTestParams);
|
||||
Wallet wallet = new Wallet(context);
|
||||
wallet.freshReceiveKey();
|
||||
|
||||
resetBlockStore();
|
||||
|
Reference in New Issue
Block a user