Apply code inspection

Cleanups
This commit is contained in:
chimp1984 2020-12-28 13:34:50 -05:00
parent 1fc8905634
commit 862b12fe03
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
10 changed files with 22 additions and 20 deletions

View File

@ -43,7 +43,7 @@ enum JsonTxOutputType {
INVALID_OUTPUT("Invalid");
@Getter
private String displayString;
private final String displayString;
JsonTxOutputType(String displayString) {
this.displayString = displayString;

View File

@ -40,7 +40,7 @@ enum JsonTxType {
IRREGULAR("Irregular");
@Getter
private String displayString;
private final String displayString;
JsonTxType(String displayString) {
this.displayString = displayString;

View File

@ -59,7 +59,7 @@ public class LiteNode extends BsqNode {
private final BsqWalletService bsqWalletService;
private final WalletsSetup walletsSetup;
private Timer checkForBlockReceivedTimer;
private ChangeListener<Number> blockDownloadListener;
private final ChangeListener<Number> blockDownloadListener;
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -152,7 +152,7 @@ public class LiteNodeNetworkService implements MessageListener, ConnectionListen
.filter(peerManager::isSeedNode)
.findAny();
connectionToSeedNodeOptional.flatMap(e -> e.getPeersNodeAddressOptional())
connectionToSeedNodeOptional.flatMap(Connection::getPeersNodeAddressOptional)
.ifPresentOrElse(candidate -> {
seedNodeAddresses.remove(candidate);
requestBlocks(candidate, startBlockHeight);

View File

@ -27,7 +27,8 @@ import com.google.common.collect.ImmutableList;
import java.util.Objects;
import java.util.stream.Collectors;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.annotation.Nullable;
@ -36,7 +37,8 @@ import javax.annotation.Nullable;
* After parsing it will get cloned to the immutable Tx.
* We don't need to implement the ProtoBuffer methods as it is not persisted or sent over the wire.
*/
@Data
@Getter
@Setter
public class TempTx extends BaseTx {
static TempTx fromRawTx(RawTx rawTx) {
return new TempTx(rawTx.getTxVersion(),

View File

@ -24,7 +24,8 @@ import bisq.core.dao.state.model.blockchain.TxOutputType;
import java.util.Objects;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.annotation.Nullable;
@ -32,7 +33,8 @@ import javax.annotation.Nullable;
* Contains mutable BSQ specific data (TxOutputType) and used only during tx parsing.
* Will get converted to immutable TxOutput after tx parsing is completed.
*/
@Data
@Getter
@Setter
public class TempTxOutput extends BaseTxOutput {
static TempTxOutput fromRawTxOutput(RawTxOutput txOutput) {
return new TempTxOutput(txOutput.getIndex(),
@ -78,6 +80,10 @@ public class TempTxOutput extends BaseTxOutput {
this.unlockBlockHeight = unlockBlockHeight;
}
public boolean isOpReturnOutput() {
// We do not check for pubKeyScript.scriptType.NULL_DATA because that is only set if dumpBlockchainData is true
return getOpReturnData() != null;
}
@Override
public String toString() {
@ -88,12 +94,6 @@ public class TempTxOutput extends BaseTxOutput {
"\n} " + super.toString();
}
public boolean isOpReturnOutput() {
// We do not check for pubKeyScript.scriptType.NULL_DATA because that is only set if dumpBlockchainData is true
return getOpReturnData() != null;
}
// Enums must not be used directly for hashCode or equals as it delivers the Object.hashCode (internal address)!
// The equals and hashCode methods cannot be overwritten in Enums.
@Override

View File

@ -87,9 +87,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
@Slf4j
class TxOutputParser {
private static int ACTIVATE_HARD_FORK_1_HEIGHT_MAINNET = 605000;
private static int ACTIVATE_HARD_FORK_1_HEIGHT_TESTNET = 1583054;
private static int ACTIVATE_HARD_FORK_1_HEIGHT_REGTEST = 1;
private static final int ACTIVATE_HARD_FORK_1_HEIGHT_MAINNET = 605000;
private static final int ACTIVATE_HARD_FORK_1_HEIGHT_TESTNET = 1583054;
private static final int ACTIVATE_HARD_FORK_1_HEIGHT_REGTEST = 1;
private final DaoStateService daoStateService;
// Setters

View File

@ -24,7 +24,7 @@ import lombok.Getter;
@Getter
public class BlockHashNotConnectingException extends Exception {
private RawBlock rawBlock;
private final RawBlock rawBlock;
public BlockHashNotConnectingException(RawBlock rawBlock) {
this.rawBlock = rawBlock;

View File

@ -24,7 +24,7 @@ import lombok.Getter;
@Getter
public class BlockHeightNotConnectingException extends Exception {
private RawBlock rawBlock;
private final RawBlock rawBlock;
public BlockHeightNotConnectingException(RawBlock rawBlock) {
this.rawBlock = rawBlock;

View File

@ -24,7 +24,7 @@ import lombok.Getter;
@Getter
public class RequiredReorgFromSnapshotException extends Exception {
private RawBlock rawBlock;
private final RawBlock rawBlock;
public RequiredReorgFromSnapshotException(RawBlock rawBlock) {
this.rawBlock = rawBlock;