diff --git a/.golangci.yml b/.golangci.yml index 4cad493..23bb24a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,13 +17,6 @@ run: # list of build tags, all linters use it. Default is empty list. build-tags: [] - # which dirs to skip: issues from them won't be reported; - # can use regexp here: generated.*, regexp is applied on full path; - # default value is empty list, but default dirs are skipped independently - # from this option's value (see skip-dirs-use-default). - skip-dirs: - - cover - # default is true. Enables skipping of directories: # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ skip-dirs-use-default: true @@ -36,9 +29,6 @@ run: # output configuration options output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number - # print lines of code with issue, default is true print-issued-lines: true @@ -65,23 +55,30 @@ linters-settings: # See https://go-critic.github.io/overview#checks-overview # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` # By default list of stable checks is used. - enabled-checks: - - argOrder # Diagnostic options - - badCond - - caseOrder - - dupArg - - dupBranchBody - - dupCase - - dupSubExpr - - nilValReturn - - offBy1 - - weakCond - - boolExprSimplify # Style options here and below. - - builtinShadow - - emptyFallthrough - - hexLiteral - - underef - - equalFold + enabled-tags: + - diagnostic + - style + disabled-checks: + # diagnostic + - commentedOutCode + - uncheckedInlineErr + + # style + - exitAfterDefer + - ifElseChain + - importShadow + - initClause + - nestingReduce + - octalLiteral + - paramTypeCombine + - ptrToRefParam + - stringsCompare + - tooManyResultsChecker + - typeDefFirst + - typeUnparen + - unlabelStmt + - unnamedResult + - whyNoLint revive: ignore-generated-header: true rules: diff --git a/chain/manager.go b/chain/manager.go index 41a7009..67f26ad 100644 --- a/chain/manager.go +++ b/chain/manager.go @@ -513,28 +513,31 @@ func (m *Manager) revalidatePool() { delete(m.txpool.indices, txid) } m.txpool.ms = consensus.NewMidState(m.tipState) - txns := append(m.txpool.txns, m.txpool.lastReverted...) - m.txpool.txns = m.txpool.txns[:0] + m.txpool.txns = append(m.txpool.txns, m.txpool.lastReverted...) m.txpool.weight = 0 - for _, txn := range txns { + filtered := m.txpool.txns[:0] + for _, txn := range m.txpool.txns { ts := m.store.SupplementTipTransaction(txn) if consensus.ValidateTransaction(m.txpool.ms, txn, ts) == nil { m.txpool.ms.ApplyTransaction(txn, ts) m.txpool.indices[txn.ID()] = len(m.txpool.txns) - m.txpool.txns = append(m.txpool.txns, txn) m.txpool.weight += m.tipState.TransactionWeight(txn) + filtered = append(filtered, txn) } } - v2txns := append(m.txpool.v2txns, m.txpool.lastRevertedV2...) - m.txpool.v2txns = m.txpool.v2txns[:0] - for _, txn := range v2txns { + m.txpool.txns = filtered + + m.txpool.v2txns = append(m.txpool.v2txns, m.txpool.lastRevertedV2...) + v2filtered := m.txpool.v2txns[:0] + for _, txn := range m.txpool.v2txns { if consensus.ValidateV2Transaction(m.txpool.ms, txn) == nil { m.txpool.ms.ApplyV2Transaction(txn) m.txpool.indices[txn.ID()] = len(m.txpool.v2txns) - m.txpool.v2txns = append(m.txpool.v2txns, txn) m.txpool.weight += m.tipState.V2TransactionWeight(txn) + v2filtered = append(v2filtered, txn) } } + m.txpool.v2txns = v2filtered } func (m *Manager) computeMedianFee() types.Currency {