Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 7 additions & 36 deletions src/main/java/org/tron/core/services/WitnessService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.tron.core.services;

import static org.tron.core.witness.BlockProductionCondition.NOT_MY_TURN;

import com.google.common.collect.Maps;
import com.google.protobuf.ByteString;
import java.util.Map;
Expand Down Expand Up @@ -101,41 +103,10 @@ private void blockProductionLoop() throws InterruptedException {
return;
}

switch (result) {
case PRODUCED:
logger.debug("Produced");
break;
case NOT_SYNCED:
logger.info("Not sync");
break;
case UNELECTED:
logger.debug("Unelected");
break;
case NOT_MY_TURN:
logger.debug("It's not my turn");
break;
case NOT_TIME_YET:
logger.info("Not time yet");
break;
case NO_PRIVATE_KEY:
logger.info("No pri key");
break;
case LOW_PARTICIPATION:
logger.info("Low part");
break;
case LAG:
logger.info("Lag");
break;
case CONSECUTIVE:
logger.info("Consecutive");
break;
case TIME_OUT:
logger.debug("Time out");
case EXCEPTION_PRODUCING_BLOCK:
logger.info("Exception");
break;
default:
break;
if (result.ordinal() <= NOT_MY_TURN.ordinal()) {
logger.debug(result.toString());
} else {
logger.info(result.toString());
}
}

Expand Down Expand Up @@ -209,7 +180,7 @@ private BlockProductionCondition tryProduceBlock() throws InterruptedException {
logger.info("It's not my turn, ScheduledWitness[{}],slot[{}],abSlot[{}],",
ByteArray.toHexString(scheduledWitness.toByteArray()), slot,
controller.getAbSlotAtTime(now));
return BlockProductionCondition.NOT_MY_TURN;
return NOT_MY_TURN;
}

long scheduledTime = controller.getSlotTime(slot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

public enum BlockProductionCondition {
PRODUCED, // Successfully generated block
NOT_SYNCED,
UNELECTED,
NOT_MY_TURN, // It isn't my turn
NOT_SYNCED,
NOT_TIME_YET, // Not yet arrived
NO_PRIVATE_KEY,
LOW_PARTICIPATION,
Expand Down