From 79460e4bfbc646421c3efdbfb662588e8b7937af Mon Sep 17 00:00:00 2001 From: wit liu <765765346@qq.com> Date: Sun, 19 Oct 2025 14:42:12 +0800 Subject: [PATCH] all: fix whitespace error of golangci-lint, remove extra empty lines (#1624) --- XDCxDAO/mongodb.go | 1 - XDCxlending/lendingstate/managed_state.go | 2 -- consensus/XDPoS/engines/engine_v2/timeout.go | 1 - consensus/XDPoS/engines/engine_v2/utils.go | 1 - consensus/tests/engine_v1_tests/block_signer_test.go | 5 ----- .../tests/engine_v1_tests/blockchain_race_condition_test.go | 2 -- consensus/tests/engine_v2_tests/helper.go | 1 - core/vm/privacy/bulletproof.go | 1 - core/vm/privacy/bulletproof_test.go | 1 - core/vm/privacy/ringct_test.go | 1 - eth/api_backend.go | 2 -- eth/handler.go | 1 - p2p/discv5/sim_test.go | 1 - 13 files changed, 20 deletions(-) diff --git a/XDCxDAO/mongodb.go b/XDCxDAO/mongodb.go index f1b9da4554..28609072c3 100644 --- a/XDCxDAO/mongodb.go +++ b/XDCxDAO/mongodb.go @@ -160,7 +160,6 @@ func (db *MongoDatabase) HasObject(hash common.Hash, val interface{}) (bool, err } func (db *MongoDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error) { - if db.IsEmptyKey(hash.Bytes()) { return nil, nil } diff --git a/XDCxlending/lendingstate/managed_state.go b/XDCxlending/lendingstate/managed_state.go index a17bc283b1..5a73e8e97b 100644 --- a/XDCxlending/lendingstate/managed_state.go +++ b/XDCxlending/lendingstate/managed_state.go @@ -129,9 +129,7 @@ func (ms *LendingManagedState) getAccount(addr common.Hash) *exchanges { if so != nil && uint64(len(account.nonces))+account.nstart < so.Nonce() { ms.lenddinges[addr] = newAccount(so) } - } - return ms.lenddinges[addr] } diff --git a/consensus/XDPoS/engines/engine_v2/timeout.go b/consensus/XDPoS/engines/engine_v2/timeout.go index 2a28e4e22d..f73d65faa2 100644 --- a/consensus/XDPoS/engines/engine_v2/timeout.go +++ b/consensus/XDPoS/engines/engine_v2/timeout.go @@ -115,7 +115,6 @@ func (x *XDPoS_v2) onTimeoutPoolThresholdReached(blockChainReader consensus.Chai } func (x *XDPoS_v2) getTCEpochInfo(chain consensus.ChainReader, timeoutCert *types.TimeoutCert) (*types.EpochSwitchInfo, error) { - epochSwitchInfo, err := x.getEpochSwitchInfo(chain, (chain.CurrentHeader()), (chain.CurrentHeader()).Hash()) if err != nil { log.Error("[getTCEpochInfo] Error when getting epoch switch info", "error", err) diff --git a/consensus/XDPoS/engines/engine_v2/utils.go b/consensus/XDPoS/engines/engine_v2/utils.go index 47d304dbae..176bb442fd 100644 --- a/consensus/XDPoS/engines/engine_v2/utils.go +++ b/consensus/XDPoS/engines/engine_v2/utils.go @@ -126,7 +126,6 @@ func (x *XDPoS_v2) verifyMsgSignature(signedHashToBeVerified common.Hash, signat } func (x *XDPoS_v2) getExtraFields(header *types.Header) (*types.QuorumCert, types.Round, []common.Address, error) { - var masternodes []common.Address // last v1 block diff --git a/consensus/tests/engine_v1_tests/block_signer_test.go b/consensus/tests/engine_v1_tests/block_signer_test.go index f9d772bceb..a6f3368378 100644 --- a/consensus/tests/engine_v1_tests/block_signer_test.go +++ b/consensus/tests/engine_v1_tests/block_signer_test.go @@ -94,7 +94,6 @@ func TestNotChangeSingerListIfNothingProposedOrVoted(t *testing.T) { // Should call updateM1 at gap block, and update the snapshot if there are SM transactions involved func TestUpdateSignerListIfVotedBeforeGap(t *testing.T) { - blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-2, params.TestXDPoSMockChainConfig) // Insert first Block 449 t.Logf("Inserting block with propose at 449...") @@ -168,7 +167,6 @@ func TestUpdateSignerListIfVotedBeforeGap(t *testing.T) { // Should call updateM1 before gap block, and update the snapshot if there are SM transactions involved func TestCallUpdateM1WithSmartContractTranscation(t *testing.T) { - blockchain, backend, currentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) // Insert first Block 450 A t.Logf("Inserting block with propose at 450 A...") @@ -205,7 +203,6 @@ func TestCallUpdateM1WithSmartContractTranscation(t *testing.T) { // Should call updateM1 and update snapshot when a forked block(at gap block number) is inserted back into main chain (Edge case) func TestCallUpdateM1WhenForkedBlockBackToMainChain(t *testing.T) { - blockchain, backend, currentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) // Check initial signer, by default, acc3 is in the signerList signers, err := GetSnapshotSigner(blockchain, blockchain.CurrentBlock().Header()) @@ -356,9 +353,7 @@ func TestCallUpdateM1WhenForkedBlockBackToMainChain(t *testing.T) { } func TestStatesShouldBeUpdatedWhenForkedBlockBecameMainChainAtGapBlock(t *testing.T) { - blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) - state, err := blockchain.State() if err != nil { t.Fatalf("Failed while trying to get blockchain state") diff --git a/consensus/tests/engine_v1_tests/blockchain_race_condition_test.go b/consensus/tests/engine_v1_tests/blockchain_race_condition_test.go index 17ea596b71..5db266c413 100644 --- a/consensus/tests/engine_v1_tests/blockchain_race_condition_test.go +++ b/consensus/tests/engine_v1_tests/blockchain_race_condition_test.go @@ -12,9 +12,7 @@ import ( // Snapshot try to read before blockchain is written func TestRaceConditionOnBlockchainReadAndWrite(t *testing.T) { - blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) - state, err := blockchain.State() if err != nil { t.Fatalf("Failed while trying to get blockchain state") diff --git a/consensus/tests/engine_v2_tests/helper.go b/consensus/tests/engine_v2_tests/helper.go index 8e57e03e5c..f327d67500 100644 --- a/consensus/tests/engine_v2_tests/helper.go +++ b/consensus/tests/engine_v2_tests/helper.go @@ -122,7 +122,6 @@ func voteTX(gasLimit uint64, nonce uint64, addr string) (*types.Transaction, err } func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.SimulatedBackend { - // initial helper backend contractBackendForSC := backends.NewXDCSimulatedBackend(types.GenesisAlloc{ voterAddr: {Balance: new(big.Int).SetUint64(10000000000)}, diff --git a/core/vm/privacy/bulletproof.go b/core/vm/privacy/bulletproof.go index 555b6c8df1..f271ec8d88 100644 --- a/core/vm/privacy/bulletproof.go +++ b/core/vm/privacy/bulletproof.go @@ -1292,7 +1292,6 @@ func NewECPrimeGroupKey(n int) CryptoParams { //fmt.Println("Got that U value") } else if confirmed == 2*n+1 { cg = ECPoint{gen2.X(), gen2.Y()} - } else if confirmed == 2*n+2 { ch = ECPoint{gen2.X(), gen2.Y()} } else { diff --git a/core/vm/privacy/bulletproof_test.go b/core/vm/privacy/bulletproof_test.go index 5d022e5e08..ab4ae83c16 100644 --- a/core/vm/privacy/bulletproof_test.go +++ b/core/vm/privacy/bulletproof_test.go @@ -146,7 +146,6 @@ func TestInnerProductProveLen64Rand(t *testing.T) { t.Error("Inner Product Proof incorrect") fmt.Printf("Values Used: \n\ta = %s\n\tb = %s\n", a, b) } - } func TestInnerProductVerifyFastLen1(t *testing.T) { diff --git a/core/vm/privacy/ringct_test.go b/core/vm/privacy/ringct_test.go index b3370497a0..dec786c35e 100644 --- a/core/vm/privacy/ringct_test.go +++ b/core/vm/privacy/ringct_test.go @@ -50,7 +50,6 @@ func TestSign(t *testing.T) { if !verified { t.Error("Failed to verify Ring signature") } - } func TestDeserialize(t *testing.T) { diff --git a/eth/api_backend.go b/eth/api_backend.go index 47449d3b79..91844d2701 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -549,9 +549,7 @@ func (b *EthAPIBackend) GetVotersRewards(masternodeAddr common.Address) map[comm break } } - return voterResults - } // GetVotersCap return all voters's capability at a checkpoint diff --git a/eth/handler.go b/eth/handler.go index 421044c21e..cf3ac5744c 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -778,7 +778,6 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { } else { pm.knownTxs.Add(tx.Hash(), struct{}{}) } - } pm.txpool.AddRemotes(txs) diff --git a/p2p/discv5/sim_test.go b/p2p/discv5/sim_test.go index 3839d0876e..2260ac412a 100644 --- a/p2p/discv5/sim_test.go +++ b/p2p/discv5/sim_test.go @@ -252,7 +252,6 @@ func (s *simulation) printStats() { fmt.Printf("*** Node %x\n", n.tab.self.ID[:8]) n.log.printLogs() }*/ - } func (s *simulation) randomNode() *Network {