Skip to content

Commit

Permalink
Apply code inspection
Browse files Browse the repository at this point in the history
Cleanups
  • Loading branch information
chimp1984 committed Dec 28, 2020
1 parent 1fc8905 commit 862b12f
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum JsonTxOutputType {
INVALID_OUTPUT("Invalid");

@Getter
private String displayString;
private final String displayString;

JsonTxOutputType(String displayString) {
this.displayString = displayString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum JsonTxType {
IRREGULAR("Irregular");

@Getter
private String displayString;
private final String displayString;

JsonTxType(String displayString) {
this.displayString = displayString;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/dao/node/lite/LiteNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;


///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void requestBlocks(int startBlockHeight) {
.filter(peerManager::isSeedNode)
.findAny();

connectionToSeedNodeOptional.flatMap(e -> e.getPeersNodeAddressOptional())
connectionToSeedNodeOptional.flatMap(Connection::getPeersNodeAddressOptional)
.ifPresentOrElse(candidate -> {
seedNodeAddresses.remove(candidate);
requestBlocks(candidate, startBlockHeight);
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/java/bisq/core/dao/node/parser/TempTx.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import java.util.Objects;
import java.util.stream.Collectors;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.annotation.Nullable;

Expand All @@ -36,7 +37,8 @@
* 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(),
Expand Down
16 changes: 8 additions & 8 deletions core/src/main/java/bisq/core/dao/node/parser/TempTxOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@

import java.util.Objects;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

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(),
Expand Down Expand Up @@ -78,6 +80,10 @@ private TempTxOutput(int index,
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() {
Expand All @@ -88,12 +94,6 @@ public String toString() {
"\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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
*/
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@Getter
public class BlockHashNotConnectingException extends Exception {

private RawBlock rawBlock;
private final RawBlock rawBlock;

public BlockHashNotConnectingException(RawBlock rawBlock) {
this.rawBlock = rawBlock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@Getter
public class BlockHeightNotConnectingException extends Exception {

private RawBlock rawBlock;
private final RawBlock rawBlock;

public BlockHeightNotConnectingException(RawBlock rawBlock) {
this.rawBlock = rawBlock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@Getter
public class RequiredReorgFromSnapshotException extends Exception {

private RawBlock rawBlock;
private final RawBlock rawBlock;

public RequiredReorgFromSnapshotException(RawBlock rawBlock) {
this.rawBlock = rawBlock;
Expand Down

0 comments on commit 862b12f

Please sign in to comment.