aergoio/aergo

View on GitHub
chain/chaindb.go

Summary

Maintainability
C
1 day
Test Coverage
F
56%

ChainDB has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

type ChainDB struct {
    cc consensus.ChainConsensus

    latest    atomic.Value //types.BlockNo
    bestBlock atomic.Value // *types.Block
Severity: Minor
Found in chain/chaindb.go - About 5 hrs to fix

    File chaindb.go has 523 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    /**
     *  @file
     *  @copyright defined in aergo/LICENSE.txt
     */
    
    
    Severity: Minor
    Found in chain/chaindb.go - About 2 hrs to fix

      Method ChainDB.dropBlock has 5 return statements (exceeds 4 allowed).
      Open

      func (cdb *ChainDB) dropBlock(dropNo types.BlockNo) error {
          logger.Info().Uint64("no", dropNo).Msg("drop block")
      
          dbTx := cdb.NewTx()
          defer dbTx.Discard()
      Severity: Major
      Found in chain/chaindb.go - About 35 mins to fix

        Method ChainDB.checkBlockDropped has 5 return statements (exceeds 4 allowed).
        Open

        func (cdb *ChainDB) checkBlockDropped(dropBlock *types.Block) error {
            no := dropBlock.GetHeader().GetBlockNo()
            hash := dropBlock.GetHash()
            txLen := len(dropBlock.GetBody().GetTxs())
        
        
        Severity: Major
        Found in chain/chaindb.go - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status