add block chain locker
package io.nuls.consensus.poc.process;
-import io.nuls.consensus.constant.ConsensusConstant;
import io.nuls.consensus.poc.constant.ConsensusStatus;
import io.nuls.consensus.poc.constant.PocConsensusConstant;
import io.nuls.consensus.poc.container.ChainContainer;
@@ -46,7 +45,6 @@ import io.nuls.kernel.func.TimeService;
import io.nuls.kernel.model.*;
import io.nuls.kernel.validate.ValidateResult;
import io.nuls.ledger.service.LedgerService;
-import io.nuls.protocol.constant.ProtocolConstant;
import io.nuls.protocol.service.BlockService;
import io.nuls.protocol.service.TransactionService;
@@ -78,6 +76,8 @@ public class ForkChainProcess {
if (ConsensusStatusContext.getConsensusStatus().ordinal() < ConsensusStatus.RUNNING.ordinal()) {
return false;
}
+ Lockers.CHAIN_LOCK.lock();
+ try {
printChainStatusLog();
@@ -127,7 +127,9 @@ public class ForkChainProcess {
}
clearExpiredChain();
-
+ } finally {
+ Lockers.CHAIN_LOCK.unlock();
+ }
return true;
}
