aergoio/aergo

View on GitHub
consensus/impl/dpos/dpos.go

Summary

Maintainability
B
4 hrs
Test Coverage
F
4%

DPoS has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

type DPoS struct {
    *Status
    consensus.ChainDB
    *component.ComponentHub
    bpc  *bp.Cluster
Severity: Minor
Found in consensus/impl/dpos/dpos.go - About 2 hrs to fix

    Function sendVotingReward has 9 return statements (exceeds 4 allowed).
    Open

    func sendVotingReward(bState *state.BlockState, dummy []byte) error {
        vrSeed := func(stateRoot []byte) int64 {
            return int64(binary.LittleEndian.Uint64(stateRoot))
        }
    
    
    Severity: Major
    Found in consensus/impl/dpos/dpos.go - About 55 mins to fix

      Function getStateDB has 5 return statements (exceeds 4 allowed).
      Open

      func getStateDB(cfg *config.Config, cdb consensus.ChainDB, sdb *state.ChainStateDB) (*statedb.StateDB, error) {
          if cfg.Blockchain.VerifyOnly {
              vprInitBlockNo := func(blockNo types.BlockNo) types.BlockNo {
                  if blockNo == 0 {
                      return blockNo
      Severity: Major
      Found in consensus/impl/dpos/dpos.go - About 35 mins to fix

        Method DPoS.getBpInfo has 5 return statements (exceeds 4 allowed).
        Open

        func (dpos *DPoS) getBpInfo(now time.Time) *bpInfo {
            s := slot.Time(now)
        
            if !s.IsFor(dpos.bpIdx(), dpos.bpc.Size()) {
                return nil
        Severity: Major
        Found in consensus/impl/dpos/dpos.go - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status