mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-11 17:55:53 +00:00
Eliminate some warnings from IntelliJ inspections. There are still quite a few but they are all harmless.
This commit is contained in:
parent
a504328044
commit
845224c8d5
@ -48,8 +48,8 @@ public class Base58 {
|
||||
}
|
||||
s.insert(0, ALPHABET.charAt(bi.intValue()));
|
||||
// Convert leading zeros too.
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
if (input[i] == 0)
|
||||
for (byte anInput : input) {
|
||||
if (anInput == 0)
|
||||
s.insert(0, ALPHABET.charAt(0));
|
||||
else
|
||||
break;
|
||||
|
@ -52,7 +52,7 @@ public class NetworkConnection {
|
||||
private final OutputStream out;
|
||||
private final InputStream in;
|
||||
// The IP address to which we are connecting.
|
||||
private InetAddress remoteIp;
|
||||
private final InetAddress remoteIp;
|
||||
private boolean usesChecksumming;
|
||||
private final NetworkParameters params;
|
||||
static final private boolean PROTOCOL_LOG = false;
|
||||
@ -82,7 +82,7 @@ public class NetworkConnection {
|
||||
// And get one back ...
|
||||
readMessage();
|
||||
// Switch to the new protocol version.
|
||||
int peerVersion = (int) ver.clientVersion;
|
||||
int peerVersion = ver.clientVersion;
|
||||
LOG("Connected to peer, version is " + peerVersion + ", services=" + Long.toHexString(
|
||||
ver.localServices) + ", time=" + new Date(ver.time.longValue() * 1000).toString());
|
||||
// BitCoinJ is a client mode implementation. That means there's not much point in us talking to other client
|
||||
|
@ -44,7 +44,7 @@ public class Peer {
|
||||
private CountDownLatch chainCompletionLatch;
|
||||
// When we want to download a block or transaction from a peer, the InventoryItem is put here whilst waiting for
|
||||
// the response. Synchronized on itself.
|
||||
private List<GetDataFuture<Block>> pendingGetBlockFutures;
|
||||
private final List<GetDataFuture<Block>> pendingGetBlockFutures;
|
||||
|
||||
/**
|
||||
* Construct a peer that handles the given network connection and reads/writes from the given block chain. Note that
|
||||
@ -217,8 +217,8 @@ public class Peer {
|
||||
// decide whether to wait forever, wait for a short while or check later after doing other work.
|
||||
private class GetDataFuture<T extends Message> implements Future<T> {
|
||||
private boolean cancelled;
|
||||
private InventoryItem item;
|
||||
private CountDownLatch latch;
|
||||
private final InventoryItem item;
|
||||
private final CountDownLatch latch;
|
||||
private T result;
|
||||
|
||||
GetDataFuture(InventoryItem item) {
|
||||
|
@ -51,12 +51,12 @@ public class Script {
|
||||
private int cursor;
|
||||
|
||||
// The stack consists of an ordered series of data buffers growing from zero up.
|
||||
private Stack<byte[]> stack;
|
||||
private final Stack<byte[]> stack;
|
||||
// The program is a set of byte[]s where each element is either [opcode] or [data, data, data ...]
|
||||
private List<byte[]> chunks;
|
||||
private boolean tracing;
|
||||
byte[] programCopy; // TODO: remove this
|
||||
private NetworkParameters params;
|
||||
private final NetworkParameters params;
|
||||
|
||||
/** Concatenates two scripts to form a new one. This is used when verifying transactions. */
|
||||
public static Script join(Script a, Script b) throws ScriptException {
|
||||
@ -321,6 +321,7 @@ public class Script {
|
||||
pushBool(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SameParameterValue"})
|
||||
private void pushBool(boolean val) {
|
||||
stack.push(new byte[] { val ? (byte)1 : (byte)0 });
|
||||
}
|
||||
|
@ -254,6 +254,7 @@ public class Transaction extends Message implements Serializable {
|
||||
* @param hashType This should always be set to SigHash.ALL currently. Other types are unused.
|
||||
* @param wallet A wallet is required to fetch the keys needed for signing.
|
||||
*/
|
||||
@SuppressWarnings({"SameParameterValue"})
|
||||
public void signInputs(SigHash hashType, Wallet wallet) throws ScriptException {
|
||||
assert inputs.size() > 0;
|
||||
assert outputs.size() > 0;
|
||||
|
@ -28,13 +28,14 @@ import java.security.NoSuchAlgorithmException;
|
||||
* A collection of various utility methods that are helpful for working with the BitCoin protocol.
|
||||
* To enable debug logging from the library, run with -Dbitcoinj.logging=true on your command line.
|
||||
*/
|
||||
@SuppressWarnings({"SameParameterValue"})
|
||||
public class Utils {
|
||||
/** How many nanocoins there are in a BitCoin. */
|
||||
public static final BigInteger COIN = new BigInteger("100000000", 10);
|
||||
/** How many nanocoins there are in 0.01 BitCoins. */
|
||||
public static final BigInteger CENT = new BigInteger("1000000", 10);
|
||||
|
||||
private static boolean logging;
|
||||
private static final boolean logging;
|
||||
|
||||
static {
|
||||
logging = Boolean.parseBoolean(System.getProperty("bitcoinj.logging", "false"));
|
||||
@ -98,8 +99,7 @@ public class Utils {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
digest.update(input, offset, length);
|
||||
byte[] first = digest.digest();
|
||||
byte[] second = digest.digest(first);
|
||||
return second;
|
||||
return digest.digest(first);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e); // Cannot happen.
|
||||
}
|
||||
@ -115,8 +115,7 @@ public class Utils {
|
||||
digest.update(input1, offset1, length1);
|
||||
digest.update(input2, offset2, length2);
|
||||
byte[] first = digest.digest();
|
||||
byte[] second = digest.digest(first);
|
||||
return second;
|
||||
return digest.digest(first);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e); // Cannot happen.
|
||||
}
|
||||
@ -154,7 +153,7 @@ public class Utils {
|
||||
return ((bytes[offset++] & 0xFFL) << 0) |
|
||||
((bytes[offset++] & 0xFFL) << 8) |
|
||||
((bytes[offset++] & 0xFFL) << 16) |
|
||||
((bytes[offset++] & 0xFFL) << 24);
|
||||
((bytes[offset] & 0xFFL) << 24);
|
||||
}
|
||||
|
||||
public static long readUint32BE(byte[] bytes, int offset) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user