Move log entry to specific places where it is useful (#6873)

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
pull/6877/head
Matt Whitehead 8 months ago committed by GitHub
parent b04e82a4c2
commit d4f9649836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/statemachine/BftFinalState.java
  2. 7
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerFactory.java
  3. 7
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/statemachine/QbftBlockHeightManagerFactory.java

@ -28,14 +28,9 @@ import org.hyperledger.besu.datatypes.Address;
import java.time.Clock; import java.time.Clock;
import java.util.Collection; import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** This is the full data set, or context, required for many of the aspects of BFT workflows. */ /** This is the full data set, or context, required for many of the aspects of BFT workflows. */
public class BftFinalState { public class BftFinalState {
private static final Logger LOG = LoggerFactory.getLogger(BftFinalState.class);
private final ValidatorProvider validatorProvider; private final ValidatorProvider validatorProvider;
private final NodeKey nodeKey; private final NodeKey nodeKey;
private final Address localAddress; private final Address localAddress;
@ -133,7 +128,6 @@ public class BftFinalState {
*/ */
public boolean isLocalNodeValidator() { public boolean isLocalNodeValidator() {
final boolean isValidator = getValidators().contains(localAddress); final boolean isValidator = getValidators().contains(localAddress);
LOG.debug(isValidator ? "Local node is a validator" : "Local node is a non-validator");
return isValidator; return isValidator;
} }

@ -20,9 +20,14 @@ import org.hyperledger.besu.consensus.ibft.payload.MessageFactory;
import org.hyperledger.besu.consensus.ibft.validation.MessageValidatorFactory; import org.hyperledger.besu.consensus.ibft.validation.MessageValidatorFactory;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** The Ibft block height manager factory. */ /** The Ibft block height manager factory. */
public class IbftBlockHeightManagerFactory { public class IbftBlockHeightManagerFactory {
private static final Logger LOG = LoggerFactory.getLogger(IbftBlockHeightManagerFactory.class);
private final IbftRoundFactory roundFactory; private final IbftRoundFactory roundFactory;
private final BftFinalState finalState; private final BftFinalState finalState;
private final MessageValidatorFactory messageValidatorFactory; private final MessageValidatorFactory messageValidatorFactory;
@ -55,8 +60,10 @@ public class IbftBlockHeightManagerFactory {
*/ */
public BaseIbftBlockHeightManager create(final BlockHeader parentHeader) { public BaseIbftBlockHeightManager create(final BlockHeader parentHeader) {
if (finalState.isLocalNodeValidator()) { if (finalState.isLocalNodeValidator()) {
LOG.debug("Local node is a validator");
return createFullBlockHeightManager(parentHeader); return createFullBlockHeightManager(parentHeader);
} else { } else {
LOG.debug("Local node is a non-validator");
return createNoOpBlockHeightManager(parentHeader); return createNoOpBlockHeightManager(parentHeader);
} }
} }

@ -21,9 +21,14 @@ import org.hyperledger.besu.consensus.qbft.validation.MessageValidatorFactory;
import org.hyperledger.besu.consensus.qbft.validator.ValidatorModeTransitionLogger; import org.hyperledger.besu.consensus.qbft.validator.ValidatorModeTransitionLogger;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** The Qbft block height manager factory. */ /** The Qbft block height manager factory. */
public class QbftBlockHeightManagerFactory { public class QbftBlockHeightManagerFactory {
private static final Logger LOG = LoggerFactory.getLogger(QbftBlockHeightManagerFactory.class);
private final QbftRoundFactory roundFactory; private final QbftRoundFactory roundFactory;
private final BftFinalState finalState; private final BftFinalState finalState;
private final MessageValidatorFactory messageValidatorFactory; private final MessageValidatorFactory messageValidatorFactory;
@ -62,8 +67,10 @@ public class QbftBlockHeightManagerFactory {
validatorModeTransitionLogger.logTransitionChange(parentHeader); validatorModeTransitionLogger.logTransitionChange(parentHeader);
if (finalState.isLocalNodeValidator()) { if (finalState.isLocalNodeValidator()) {
LOG.debug("Local node is a validator");
return createFullBlockHeightManager(parentHeader); return createFullBlockHeightManager(parentHeader);
} else { } else {
LOG.debug("Local node is a non-validator");
return createNoOpBlockHeightManager(parentHeader); return createNoOpBlockHeightManager(parentHeader);
} }
} }

Loading…
Cancel
Save