all: fix whitespace error of golangci-lint, remove extra empty lines (#1624)

This commit is contained in:
wit liu 2025-10-19 14:42:12 +08:00 committed by GitHub
parent 9f14aebcae
commit 79460e4bfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 0 additions and 20 deletions

View file

@ -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) { func (db *MongoDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error) {
if db.IsEmptyKey(hash.Bytes()) { if db.IsEmptyKey(hash.Bytes()) {
return nil, nil return nil, nil
} }

View file

@ -129,9 +129,7 @@ func (ms *LendingManagedState) getAccount(addr common.Hash) *exchanges {
if so != nil && uint64(len(account.nonces))+account.nstart < so.Nonce() { if so != nil && uint64(len(account.nonces))+account.nstart < so.Nonce() {
ms.lenddinges[addr] = newAccount(so) ms.lenddinges[addr] = newAccount(so)
} }
} }
return ms.lenddinges[addr] return ms.lenddinges[addr]
} }

View file

@ -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) { func (x *XDPoS_v2) getTCEpochInfo(chain consensus.ChainReader, timeoutCert *types.TimeoutCert) (*types.EpochSwitchInfo, error) {
epochSwitchInfo, err := x.getEpochSwitchInfo(chain, (chain.CurrentHeader()), (chain.CurrentHeader()).Hash()) epochSwitchInfo, err := x.getEpochSwitchInfo(chain, (chain.CurrentHeader()), (chain.CurrentHeader()).Hash())
if err != nil { if err != nil {
log.Error("[getTCEpochInfo] Error when getting epoch switch info", "error", err) log.Error("[getTCEpochInfo] Error when getting epoch switch info", "error", err)

View file

@ -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) { func (x *XDPoS_v2) getExtraFields(header *types.Header) (*types.QuorumCert, types.Round, []common.Address, error) {
var masternodes []common.Address var masternodes []common.Address
// last v1 block // last v1 block

View file

@ -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 // Should call updateM1 at gap block, and update the snapshot if there are SM transactions involved
func TestUpdateSignerListIfVotedBeforeGap(t *testing.T) { func TestUpdateSignerListIfVotedBeforeGap(t *testing.T) {
blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-2, params.TestXDPoSMockChainConfig) blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-2, params.TestXDPoSMockChainConfig)
// Insert first Block 449 // Insert first Block 449
t.Logf("Inserting block with propose at 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 // Should call updateM1 before gap block, and update the snapshot if there are SM transactions involved
func TestCallUpdateM1WithSmartContractTranscation(t *testing.T) { func TestCallUpdateM1WithSmartContractTranscation(t *testing.T) {
blockchain, backend, currentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) blockchain, backend, currentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig)
// Insert first Block 450 A // Insert first Block 450 A
t.Logf("Inserting block with propose at 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) // 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) { func TestCallUpdateM1WhenForkedBlockBackToMainChain(t *testing.T) {
blockchain, backend, currentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) blockchain, backend, currentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig)
// Check initial signer, by default, acc3 is in the signerList // Check initial signer, by default, acc3 is in the signerList
signers, err := GetSnapshotSigner(blockchain, blockchain.CurrentBlock().Header()) signers, err := GetSnapshotSigner(blockchain, blockchain.CurrentBlock().Header())
@ -356,9 +353,7 @@ func TestCallUpdateM1WhenForkedBlockBackToMainChain(t *testing.T) {
} }
func TestStatesShouldBeUpdatedWhenForkedBlockBecameMainChainAtGapBlock(t *testing.T) { func TestStatesShouldBeUpdatedWhenForkedBlockBecameMainChainAtGapBlock(t *testing.T) {
blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig)
state, err := blockchain.State() state, err := blockchain.State()
if err != nil { if err != nil {
t.Fatalf("Failed while trying to get blockchain state") t.Fatalf("Failed while trying to get blockchain state")

View file

@ -12,9 +12,7 @@ import (
// Snapshot try to read before blockchain is written // Snapshot try to read before blockchain is written
func TestRaceConditionOnBlockchainReadAndWrite(t *testing.T) { func TestRaceConditionOnBlockchainReadAndWrite(t *testing.T) {
blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig) blockchain, backend, parentBlock, signer, signFn := PrepareXDCTestBlockChain(t, GAP-1, params.TestXDPoSMockChainConfig)
state, err := blockchain.State() state, err := blockchain.State()
if err != nil { if err != nil {
t.Fatalf("Failed while trying to get blockchain state") t.Fatalf("Failed while trying to get blockchain state")

View file

@ -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 { func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.SimulatedBackend {
// initial helper backend // initial helper backend
contractBackendForSC := backends.NewXDCSimulatedBackend(types.GenesisAlloc{ contractBackendForSC := backends.NewXDCSimulatedBackend(types.GenesisAlloc{
voterAddr: {Balance: new(big.Int).SetUint64(10000000000)}, voterAddr: {Balance: new(big.Int).SetUint64(10000000000)},

View file

@ -1292,7 +1292,6 @@ func NewECPrimeGroupKey(n int) CryptoParams {
//fmt.Println("Got that U value") //fmt.Println("Got that U value")
} else if confirmed == 2*n+1 { } else if confirmed == 2*n+1 {
cg = ECPoint{gen2.X(), gen2.Y()} cg = ECPoint{gen2.X(), gen2.Y()}
} else if confirmed == 2*n+2 { } else if confirmed == 2*n+2 {
ch = ECPoint{gen2.X(), gen2.Y()} ch = ECPoint{gen2.X(), gen2.Y()}
} else { } else {

View file

@ -146,7 +146,6 @@ func TestInnerProductProveLen64Rand(t *testing.T) {
t.Error("Inner Product Proof incorrect") t.Error("Inner Product Proof incorrect")
fmt.Printf("Values Used: \n\ta = %s\n\tb = %s\n", a, b) fmt.Printf("Values Used: \n\ta = %s\n\tb = %s\n", a, b)
} }
} }
func TestInnerProductVerifyFastLen1(t *testing.T) { func TestInnerProductVerifyFastLen1(t *testing.T) {

View file

@ -50,7 +50,6 @@ func TestSign(t *testing.T) {
if !verified { if !verified {
t.Error("Failed to verify Ring signature") t.Error("Failed to verify Ring signature")
} }
} }
func TestDeserialize(t *testing.T) { func TestDeserialize(t *testing.T) {

View file

@ -549,9 +549,7 @@ func (b *EthAPIBackend) GetVotersRewards(masternodeAddr common.Address) map[comm
break break
} }
} }
return voterResults return voterResults
} }
// GetVotersCap return all voters's capability at a checkpoint // GetVotersCap return all voters's capability at a checkpoint

View file

@ -778,7 +778,6 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
} else { } else {
pm.knownTxs.Add(tx.Hash(), struct{}{}) pm.knownTxs.Add(tx.Hash(), struct{}{})
} }
} }
pm.txpool.AddRemotes(txs) pm.txpool.AddRemotes(txs)

View file

@ -252,7 +252,6 @@ func (s *simulation) printStats() {
fmt.Printf("*** Node %x\n", n.tab.self.ID[:8]) fmt.Printf("*** Node %x\n", n.tab.self.ID[:8])
n.log.printLogs() n.log.printLogs()
}*/ }*/
} }
func (s *simulation) randomNode() *Network { func (s *simulation) randomNode() *Network {