@@ -217,9 +217,9 @@ func (bs *BlockService) ChainWriteLock(actionType int) {
217
217
218
218
// ChainWriteUnlock unlocks the chain
219
219
func (bs * BlockService ) ChainWriteUnlock (actionType int ) {
220
- monitoring .SetBlockchainStatus (bs .Chaintype , constant .BlockchainStatusIdle )
221
- monitoring .DecrementStatusLockCounter (bs .Chaintype , actionType )
222
220
bs .Unlock ()
221
+ monitoring .DecrementStatusLockCounter (bs .Chaintype , actionType )
222
+ monitoring .SetBlockchainStatus (bs .Chaintype , constant .BlockchainStatusIdle )
223
223
}
224
224
225
225
// NewGenesisBlock create new block that is fixed in the value of cumulative difficulty, smith scale, and the block signature
@@ -638,8 +638,8 @@ func (bs *BlockService) PushBlock(previousBlock, block *model.Block, broadcast,
638
638
639
639
// ScanBlockPool scan the whole block pool to check if there are any block that's legal to be pushed yet
640
640
func (bs * BlockService ) ScanBlockPool () error {
641
- bs .ChainWriteLock (constant .BlockchainStatusReceivingBlock )
642
- defer bs .ChainWriteUnlock (constant .BlockchainStatusReceivingBlock )
641
+ bs .ChainWriteLock (constant .BlockchainStatusReceivingBlockScanBlockPool )
642
+ defer bs .ChainWriteUnlock (constant .BlockchainStatusReceivingBlockScanBlockPool )
643
643
previousBlock , err := bs .GetLastBlock ()
644
644
if err != nil {
645
645
return err
@@ -1478,8 +1478,8 @@ func (bs *BlockService) WillSmith(
1478
1478
1479
1479
// ProcessCompletedBlock to process block that already having all needed transactions
1480
1480
func (bs * BlockService ) ProcessCompletedBlock (block * model.Block ) error {
1481
- bs .ChainWriteLock (constant .BlockchainStatusReceivingBlock )
1482
- defer bs .ChainWriteUnlock (constant .BlockchainStatusReceivingBlock )
1481
+ bs .ChainWriteLock (constant .BlockchainStatusReceivingBlockProcessCompletedBlock )
1482
+ defer bs .ChainWriteUnlock (constant .BlockchainStatusReceivingBlockProcessCompletedBlock )
1483
1483
lastBlock , err := bs .GetLastBlock ()
1484
1484
if err != nil {
1485
1485
return err
0 commit comments