From b0b1215bb8233121718801cba61c52c051d22c45 Mon Sep 17 00:00:00 2001 From: Adrian Dobrita Date: Thu, 26 Feb 2026 11:56:48 +0200 Subject: [PATCH] fix linter issues --- .../presenter/presenterStatusHandler.go | 1 - process/coordinator/processProposal.go | 7 ++--- process/sync/baseSync.go | 27 ------------------- .../antiflood/factory/p2pOutputAntiflood.go | 3 +-- .../floodPreventers/quotaFloodPreventer.go | 7 +++-- trie/branchNode.go | 9 ++----- 6 files changed, 8 insertions(+), 46 deletions(-) diff --git a/cmd/termui/presenter/presenterStatusHandler.go b/cmd/termui/presenter/presenterStatusHandler.go index 1722eedbcb4..a5a00166ffe 100644 --- a/cmd/termui/presenter/presenterStatusHandler.go +++ b/cmd/termui/presenter/presenterStatusHandler.go @@ -15,7 +15,6 @@ type PresenterStatusHandler struct { mutPresenterMap sync.RWMutex logLines []string mutLogLineWrite sync.RWMutex - oldRound uint64 synchronizationSpeedHistory []uint64 totalRewardsOld *big.Float } diff --git a/process/coordinator/processProposal.go b/process/coordinator/processProposal.go index 32825ec6e1e..3110c69ba39 100644 --- a/process/coordinator/processProposal.go +++ b/process/coordinator/processProposal.go @@ -186,11 +186,8 @@ func (tc *transactionCoordinator) getAOTSelection(nonce uint64) ([][]byte, []dat func (tc *transactionCoordinator) SelectOutgoingTransactions( nonce uint64, haveTimeForSelection func() bool, -) (selectedTxHashes [][]byte, selectedPendingIncomingMiniBlocks []data.MiniBlockHeaderHandler) { - selectedTxHashes = make([][]byte, 0) - selectedTxs := make([]data.TransactionHandler, 0) - - selectedTxHashes, selectedTxs = tc.getAOTSelection(nonce) +) ([][]byte, []data.MiniBlockHeaderHandler) { + selectedTxHashes, selectedTxs := tc.getAOTSelection(nonce) // if no tx returned from AOT selection, fallback to regular selection from pre-processors if len(selectedTxs) == 0 { for _, blockType := range tc.preProcProposal.keysTxPreProcs { diff --git a/process/sync/baseSync.go b/process/sync/baseSync.go index bdf60dd6ed3..8d2234b8ebb 100644 --- a/process/sync/baseSync.go +++ b/process/sync/baseSync.go @@ -1964,16 +1964,6 @@ func (boot *baseBootstrap) getHeaderFromPool(hash []byte) (data.HeaderHandler, e return process.GetShardHeaderFromPool(hash, boot.headers) } -func (boot *baseBootstrap) getHeaderWithNonce( - nonce uint64, -) (data.HeaderHandler, []byte, error) { - if boot.shardCoordinator.SelfId() == core.MetachainShardId { - return boot.getMetaHeaderWithNonce(nonce) - } - - return boot.getShardHeaderWithNonce(nonce) -} - func (boot *baseBootstrap) getMetaHeaderWithNonce( nonce uint64, ) (data.HeaderHandler, []byte, error) { @@ -1990,23 +1980,6 @@ func (boot *baseBootstrap) getMetaHeaderWithNonce( ) } -func (boot *baseBootstrap) getShardHeaderWithNonce( - nonce uint64, -) (data.HeaderHandler, []byte, error) { - header, hash, err := process.GetShardHeaderFromPoolWithNonce(nonce, boot.shardCoordinator.SelfId(), boot.headers) - if err == nil { - return header, hash, nil - } - - return process.GetShardHeaderFromStorageWithNonce( - nonce, - boot.shardCoordinator.SelfId(), - boot.store, - boot.uint64Converter, - boot.marshalizer, - ) -} - func (boot *baseBootstrap) getHeaderFromPoolWithNonce( nonce uint64, ) (data.HeaderHandler, []byte, error) { diff --git a/process/throttle/antiflood/factory/p2pOutputAntiflood.go b/process/throttle/antiflood/factory/p2pOutputAntiflood.go index 5292b5a2508..1369ccc6db1 100644 --- a/process/throttle/antiflood/factory/p2pOutputAntiflood.go +++ b/process/throttle/antiflood/factory/p2pOutputAntiflood.go @@ -4,6 +4,7 @@ import ( "context" "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/config" "github.com/multiversx/mx-chain-go/process" @@ -14,8 +15,6 @@ import ( "github.com/multiversx/mx-chain-go/storage/storageunit" ) -const outputReservedPercent = float32(0) - // NewP2POutputAntiFlood will return an instance of an output antiflood component based on the config func NewP2POutputAntiFlood( ctx context.Context, diff --git a/process/throttle/antiflood/floodPreventers/quotaFloodPreventer.go b/process/throttle/antiflood/floodPreventers/quotaFloodPreventer.go index 700bff52bd1..da00b085abc 100644 --- a/process/throttle/antiflood/floodPreventers/quotaFloodPreventer.go +++ b/process/throttle/antiflood/floodPreventers/quotaFloodPreventer.go @@ -6,6 +6,7 @@ import ( "github.com/multiversx/mx-chain-core-go/core" "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/process" "github.com/multiversx/mx-chain-go/storage" @@ -22,10 +23,8 @@ type ArgQuotaFloodPreventer struct { var _ process.FloodPreventer = (*quotaFloodPreventer)(nil) const minMessages = 1 -const minTotalSize = 1 //1Byte +const minTotalSize = 1 // 1Byte const initNumMessages = 1 -const maxPercentReserved = 90.0 -const minPercentReserved = 0.0 const quotaStructSize = 24 type quota struct { @@ -143,7 +142,7 @@ func (qfp *quotaFloodPreventer) Reset() { qfp.resetStatusHandlers() qfp.createStatistics() - //TODO change this if cacher.Clear() is time consuming + // TODO change this if cacher.Clear() is time consuming qfp.cacher.Clear() } diff --git a/trie/branchNode.go b/trie/branchNode.go index be63ec7eee2..8e3584d0589 100644 --- a/trie/branchNode.go +++ b/trie/branchNode.go @@ -11,9 +11,10 @@ import ( "github.com/multiversx/mx-chain-core-go/core/check" "github.com/multiversx/mx-chain-core-go/hashing" "github.com/multiversx/mx-chain-core-go/marshal" + vmcommon "github.com/multiversx/mx-chain-vm-common-go" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/trie/leavesRetriever/trieNodeData" - vmcommon "github.com/multiversx/mx-chain-vm-common-go" ) var _ = node(&branchNode{}) @@ -334,12 +335,6 @@ func (bn *branchNode) commitSnapshot( return nil } -func (bn *branchNode) removeChildrenPointers() { - for i := range bn.children { - bn.children[i] = nil - } -} - func (bn *branchNode) getEncodedNode() ([]byte, error) { err := bn.isEmptyOrNil() if err != nil {