mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-23 19:37:51 +00:00
Removed pointless boolean Expression
This commit is contained in:
parent
61ede811cd
commit
d58fbab1b5
@ -5290,7 +5290,7 @@ public final class Service {
|
|||||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(vendor_)) {
|
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(vendor_)) {
|
||||||
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, vendor_);
|
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, vendor_);
|
||||||
}
|
}
|
||||||
if (taddrSupport_ != false) {
|
if (taddrSupport_) {
|
||||||
output.writeBool(3, taddrSupport_);
|
output.writeBool(3, taddrSupport_);
|
||||||
}
|
}
|
||||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(chainName_)) {
|
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(chainName_)) {
|
||||||
@ -5341,7 +5341,7 @@ public final class Service {
|
|||||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(vendor_)) {
|
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(vendor_)) {
|
||||||
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, vendor_);
|
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, vendor_);
|
||||||
}
|
}
|
||||||
if (taddrSupport_ != false) {
|
if (taddrSupport_) {
|
||||||
size += com.google.protobuf.CodedOutputStream
|
size += com.google.protobuf.CodedOutputStream
|
||||||
.computeBoolSize(3, taddrSupport_);
|
.computeBoolSize(3, taddrSupport_);
|
||||||
}
|
}
|
||||||
@ -5729,7 +5729,7 @@ public final class Service {
|
|||||||
vendor_ = other.vendor_;
|
vendor_ = other.vendor_;
|
||||||
onChanged();
|
onChanged();
|
||||||
}
|
}
|
||||||
if (other.getTaddrSupport() != false) {
|
if (other.getTaddrSupport()) {
|
||||||
setTaddrSupport(other.getTaddrSupport());
|
setTaddrSupport(other.getTaddrSupport());
|
||||||
}
|
}
|
||||||
if (!other.getChainName().isEmpty()) {
|
if (!other.getChainName().isEmpty()) {
|
||||||
|
@ -41,7 +41,7 @@ public class GatewayResource {
|
|||||||
private ArbitraryResourceStatus getStatus(Service service, String name, String identifier, Boolean build) {
|
private ArbitraryResourceStatus getStatus(Service service, String name, String identifier, Boolean build) {
|
||||||
|
|
||||||
// If "build=true" has been specified in the query string, build the resource before returning its status
|
// If "build=true" has been specified in the query string, build the resource before returning its status
|
||||||
if (build != null && build == true) {
|
if (build != null && build) {
|
||||||
try {
|
try {
|
||||||
ArbitraryDataReader reader = new ArbitraryDataReader(name, ArbitraryDataFile.ResourceIdType.NAME, service, null);
|
ArbitraryDataReader reader = new ArbitraryDataReader(name, ArbitraryDataFile.ResourceIdType.NAME, service, null);
|
||||||
if (!reader.isBuilding()) {
|
if (!reader.isBuilding()) {
|
||||||
|
@ -119,7 +119,7 @@ public class ArbitraryResource {
|
|||||||
|
|
||||||
// Ensure that "default" and "identifier" parameters cannot coexist
|
// Ensure that "default" and "identifier" parameters cannot coexist
|
||||||
boolean defaultRes = Boolean.TRUE.equals(defaultResource);
|
boolean defaultRes = Boolean.TRUE.equals(defaultResource);
|
||||||
if (defaultRes == true && identifier != null) {
|
if (defaultRes && identifier != null) {
|
||||||
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "identifier cannot be specified when requesting a default resource");
|
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "identifier cannot be specified when requesting a default resource");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1258,7 +1258,7 @@ public class ArbitraryResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finish here if user has requested a preview
|
// Finish here if user has requested a preview
|
||||||
if (preview != null && preview == true) {
|
if (preview != null && preview) {
|
||||||
return this.preview(path, service);
|
return this.preview(path, service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class BlocksResource {
|
|||||||
// Check the database first
|
// Check the database first
|
||||||
BlockData blockData = repository.getBlockRepository().fromSignature(signature);
|
BlockData blockData = repository.getBlockRepository().fromSignature(signature);
|
||||||
if (blockData != null) {
|
if (blockData != null) {
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
return blockData;
|
return blockData;
|
||||||
@ -95,7 +95,7 @@ public class BlocksResource {
|
|||||||
// Not found, so try the block archive
|
// Not found, so try the block archive
|
||||||
blockData = repository.getBlockArchiveRepository().fromSignature(signature);
|
blockData = repository.getBlockArchiveRepository().fromSignature(signature);
|
||||||
if (blockData != null) {
|
if (blockData != null) {
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
return blockData;
|
return blockData;
|
||||||
@ -304,7 +304,7 @@ public class BlocksResource {
|
|||||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||||
BlockData blockData = repository.getBlockRepository().getLastBlock();
|
BlockData blockData = repository.getBlockRepository().getLastBlock();
|
||||||
|
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ public class BlocksResource {
|
|||||||
// Firstly check the database
|
// Firstly check the database
|
||||||
BlockData blockData = repository.getBlockRepository().fromHeight(height);
|
BlockData blockData = repository.getBlockRepository().fromHeight(height);
|
||||||
if (blockData != null) {
|
if (blockData != null) {
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
return blockData;
|
return blockData;
|
||||||
@ -483,7 +483,7 @@ public class BlocksResource {
|
|||||||
// Not found, so try the archive
|
// Not found, so try the archive
|
||||||
blockData = repository.getBlockArchiveRepository().fromHeight(height);
|
blockData = repository.getBlockArchiveRepository().fromHeight(height);
|
||||||
if (blockData != null) {
|
if (blockData != null) {
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
return blockData;
|
return blockData;
|
||||||
@ -596,7 +596,7 @@ public class BlocksResource {
|
|||||||
if (height > 1) {
|
if (height > 1) {
|
||||||
// Found match in Blocks table
|
// Found match in Blocks table
|
||||||
blockData = repository.getBlockRepository().fromHeight(height);
|
blockData = repository.getBlockRepository().fromHeight(height);
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
return blockData;
|
return blockData;
|
||||||
@ -614,7 +614,7 @@ public class BlocksResource {
|
|||||||
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.BLOCK_UNKNOWN);
|
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.BLOCK_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ public class BlocksResource {
|
|||||||
@QueryParam("includeOnlineSignatures") Boolean includeOnlineSignatures) {
|
@QueryParam("includeOnlineSignatures") Boolean includeOnlineSignatures) {
|
||||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||||
List<BlockData> blocks = new ArrayList<>();
|
List<BlockData> blocks = new ArrayList<>();
|
||||||
boolean shouldReverse = (reverse != null && reverse == true);
|
boolean shouldReverse = (reverse != null && reverse);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < count) {
|
while (i < count) {
|
||||||
@ -664,7 +664,7 @@ public class BlocksResource {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (includeOnlineSignatures == null || includeOnlineSignatures == false) {
|
if (includeOnlineSignatures == null || !includeOnlineSignatures) {
|
||||||
blockData.setOnlineAccountsSignatures(null);
|
blockData.setOnlineAccountsSignatures(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ public class CrossChainResource {
|
|||||||
int maximumCount = maxtrades != null ? maxtrades : 10;
|
int maximumCount = maxtrades != null ? maxtrades : 10;
|
||||||
long minimumPeriod = 4 * 60 * 60 * 1000L; // ms
|
long minimumPeriod = 4 * 60 * 60 * 1000L; // ms
|
||||||
Boolean isFinished = Boolean.TRUE;
|
Boolean isFinished = Boolean.TRUE;
|
||||||
boolean useInversePrice = (inverse != null && inverse == true);
|
boolean useInversePrice = (inverse != null && inverse);
|
||||||
|
|
||||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||||
Map<ByteArray, Supplier<ACCT>> acctsByCodeHash = SupportedBlockchain.getFilteredAcctMap(foreignBlockchain);
|
Map<ByteArray, Supplier<ACCT>> acctsByCodeHash = SupportedBlockchain.getFilteredAcctMap(foreignBlockchain);
|
||||||
|
@ -132,7 +132,7 @@ public class AT {
|
|||||||
// Nothing happened?
|
// Nothing happened?
|
||||||
if (state.getSteps() == 0 && Arrays.equals(stateHash, latestAtStateData.getStateHash()))
|
if (state.getSteps() == 0 && Arrays.equals(stateHash, latestAtStateData.getStateHash()))
|
||||||
// We currently want to execute frozen ATs, to maintain backwards support.
|
// We currently want to execute frozen ATs, to maintain backwards support.
|
||||||
if (state.isFrozen() == false)
|
if (!state.isFrozen())
|
||||||
// this.atStateData will be null
|
// this.atStateData will be null
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ public class BlockMinter extends Thread {
|
|||||||
|
|
||||||
// Disregard peers that don't have a recent block, but only if we're not in recovery mode.
|
// Disregard peers that don't have a recent block, but only if we're not in recovery mode.
|
||||||
// In that mode, we want to allow minting on top of older blocks, to recover stalled networks.
|
// In that mode, we want to allow minting on top of older blocks, to recover stalled networks.
|
||||||
if (Synchronizer.getInstance().getRecoveryMode() == false)
|
if (!Synchronizer.getInstance().getRecoveryMode())
|
||||||
peers.removeIf(Controller.hasNoRecentBlock);
|
peers.removeIf(Controller.hasNoRecentBlock);
|
||||||
|
|
||||||
// Don't mint if we don't have enough up-to-date peers as where would the transactions/consensus come from?
|
// Don't mint if we don't have enough up-to-date peers as where would the transactions/consensus come from?
|
||||||
@ -197,7 +197,7 @@ public class BlockMinter extends Thread {
|
|||||||
|
|
||||||
// If our latest block isn't recent then we need to synchronize instead of minting, unless we're in recovery mode.
|
// If our latest block isn't recent then we need to synchronize instead of minting, unless we're in recovery mode.
|
||||||
if (!peers.isEmpty() && lastBlockData.getTimestamp() < minLatestBlockTimestamp)
|
if (!peers.isEmpty() && lastBlockData.getTimestamp() < minLatestBlockTimestamp)
|
||||||
if (Synchronizer.getInstance().getRecoveryMode() == false && recoverInvalidBlock == false)
|
if (!Synchronizer.getInstance().getRecoveryMode() && !recoverInvalidBlock)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// There are enough peers with a recent block and our latest block is recent
|
// There are enough peers with a recent block and our latest block is recent
|
||||||
|
@ -775,7 +775,7 @@ public class Controller extends Thread {
|
|||||||
|
|
||||||
public static final Predicate<Peer> hasOldVersion = peer -> {
|
public static final Predicate<Peer> hasOldVersion = peer -> {
|
||||||
final String minPeerVersion = Settings.getInstance().getMinPeerVersion();
|
final String minPeerVersion = Settings.getInstance().getMinPeerVersion();
|
||||||
return peer.isAtLeastVersion(minPeerVersion) == false;
|
return !peer.isAtLeastVersion(minPeerVersion);
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Predicate<Peer> hasInvalidSigner = peer -> {
|
public static final Predicate<Peer> hasInvalidSigner = peer -> {
|
||||||
|
@ -406,7 +406,7 @@ public class Synchronizer extends Thread {
|
|||||||
// If enough time has passed, enter recovery mode, which lifts some restrictions on who we can sync with and when we can mint
|
// If enough time has passed, enter recovery mode, which lifts some restrictions on who we can sync with and when we can mint
|
||||||
long recoveryModeTimeout = Settings.getInstance().getRecoveryModeTimeout();
|
long recoveryModeTimeout = Settings.getInstance().getRecoveryModeTimeout();
|
||||||
if (NTP.getTime() - timePeersLastAvailable > recoveryModeTimeout) {
|
if (NTP.getTime() - timePeersLastAvailable > recoveryModeTimeout) {
|
||||||
if (recoveryMode == false) {
|
if (!recoveryMode) {
|
||||||
LOGGER.info(String.format("Peers have been unavailable for %d minutes. Entering recovery mode...", recoveryModeTimeout/60/1000));
|
LOGGER.info(String.format("Peers have been unavailable for %d minutes. Entering recovery mode...", recoveryModeTimeout/60/1000));
|
||||||
recoveryMode = true;
|
recoveryMode = true;
|
||||||
}
|
}
|
||||||
@ -663,7 +663,7 @@ public class Synchronizer extends Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useCachedSummaries == false) {
|
if (!useCachedSummaries) {
|
||||||
if (summariesRequired > 0) {
|
if (summariesRequired > 0) {
|
||||||
LOGGER.trace(String.format("Requesting %d block summar%s from peer %s after common block %.8s. Peer height: %d", summariesRequired, (summariesRequired != 1 ? "ies" : "y"), peer, Base58.encode(commonBlockSummary.getSignature()), peerHeight));
|
LOGGER.trace(String.format("Requesting %d block summar%s from peer %s after common block %.8s. Peer height: %d", summariesRequired, (summariesRequired != 1 ? "ies" : "y"), peer, Base58.encode(commonBlockSummary.getSignature()), peerHeight));
|
||||||
|
|
||||||
|
@ -70,15 +70,15 @@ public enum Handshake {
|
|||||||
peer.setPeersVersion(versionString, version);
|
peer.setPeersVersion(versionString, version);
|
||||||
|
|
||||||
// Ensure the peer is running at least the version specified in MIN_PEER_VERSION
|
// Ensure the peer is running at least the version specified in MIN_PEER_VERSION
|
||||||
if (peer.isAtLeastVersion(MIN_PEER_VERSION) == false) {
|
if (!peer.isAtLeastVersion(MIN_PEER_VERSION)) {
|
||||||
LOGGER.debug(String.format("Ignoring peer %s because it is on an old version (%s)", peer, versionString));
|
LOGGER.debug(String.format("Ignoring peer %s because it is on an old version (%s)", peer, versionString));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.getInstance().getAllowConnectionsWithOlderPeerVersions() == false) {
|
if (!Settings.getInstance().getAllowConnectionsWithOlderPeerVersions()) {
|
||||||
// Ensure the peer is running at least the minimum version allowed for connections
|
// Ensure the peer is running at least the minimum version allowed for connections
|
||||||
final String minPeerVersion = Settings.getInstance().getMinPeerVersion();
|
final String minPeerVersion = Settings.getInstance().getMinPeerVersion();
|
||||||
if (peer.isAtLeastVersion(minPeerVersion) == false) {
|
if (!peer.isAtLeastVersion(minPeerVersion)) {
|
||||||
LOGGER.debug(String.format("Ignoring peer %s because it is on an old version (%s)", peer, versionString));
|
LOGGER.debug(String.format("Ignoring peer %s because it is on an old version (%s)", peer, versionString));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -69,10 +69,10 @@ public class HSQLDBChatRepository implements ChatRepository {
|
|||||||
bindParams.add(chatReferenceBytes);
|
bindParams.add(chatReferenceBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasChatReference != null && hasChatReference == true) {
|
if (hasChatReference != null && hasChatReference) {
|
||||||
whereClauses.add("chat_reference IS NOT NULL");
|
whereClauses.add("chat_reference IS NOT NULL");
|
||||||
}
|
}
|
||||||
else if (hasChatReference != null && hasChatReference == false) {
|
else if (hasChatReference != null && !hasChatReference) {
|
||||||
whereClauses.add("chat_reference IS NULL");
|
whereClauses.add("chat_reference IS NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ public class HSQLDBImportExport {
|
|||||||
String existingTradePrivateKey = (String) existingTradeBotDataItem.get("tradePrivateKey");
|
String existingTradePrivateKey = (String) existingTradeBotDataItem.get("tradePrivateKey");
|
||||||
// Check if we already have an entry for this trade
|
// Check if we already have an entry for this trade
|
||||||
boolean found = allTradeBotData.stream().anyMatch(tradeBotData -> Base58.encode(tradeBotData.getTradePrivateKey()).equals(existingTradePrivateKey));
|
boolean found = allTradeBotData.stream().anyMatch(tradeBotData -> Base58.encode(tradeBotData.getTradePrivateKey()).equals(existingTradePrivateKey));
|
||||||
if (found == false)
|
if (!found)
|
||||||
// Add the data from the backup file to our "allTradeBotDataJson" array as it's not currently in the db
|
// Add the data from the backup file to our "allTradeBotDataJson" array as it's not currently in the db
|
||||||
allTradeBotDataJson.put(existingTradeBotDataItem);
|
allTradeBotDataJson.put(existingTradeBotDataItem);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class RewardShareTransaction extends Transaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private RewardShareData getExistingRewardShare() throws DataException {
|
private RewardShareData getExistingRewardShare() throws DataException {
|
||||||
if (this.haveCheckedForExistingRewardShare == false) {
|
if (!this.haveCheckedForExistingRewardShare) {
|
||||||
this.haveCheckedForExistingRewardShare = true;
|
this.haveCheckedForExistingRewardShare = true;
|
||||||
|
|
||||||
// Look up any existing reward-share (using transaction's reward-share public key)
|
// Look up any existing reward-share (using transaction's reward-share public key)
|
||||||
|
@ -398,7 +398,7 @@ public class ArbitraryTransactionUtils {
|
|||||||
public static ArbitraryResourceStatus getStatus(Service service, String name, String identifier, Boolean build, boolean updateCache) {
|
public static ArbitraryResourceStatus getStatus(Service service, String name, String identifier, Boolean build, boolean updateCache) {
|
||||||
|
|
||||||
// If "build" has been specified, build the resource before returning its status
|
// If "build" has been specified, build the resource before returning its status
|
||||||
if (build != null && build == true) {
|
if (build != null && build) {
|
||||||
try {
|
try {
|
||||||
ArbitraryDataReader reader = new ArbitraryDataReader(name, ArbitraryDataFile.ResourceIdType.NAME, service, identifier);
|
ArbitraryDataReader reader = new ArbitraryDataReader(name, ArbitraryDataFile.ResourceIdType.NAME, service, identifier);
|
||||||
if (!reader.isBuilding()) {
|
if (!reader.isBuilding()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user