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

This commit is contained in:
wit liu 2025-11-17 13:46:09 +08:00 committed by GitHub
parent 1fa780768f
commit 39eb15531d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 4 additions and 22 deletions

View file

@ -351,7 +351,6 @@ func Test_getCancelFee(t *testing.T) {
if fee, _ := XDCx.getCancelFee(nil, nil, tradingStateDb, tokenDOrder.order, tokenDOrder.feeRate); fee != nil && fee.Sign() != 0 { if fee, _ := XDCx.getCancelFee(nil, nil, tradingStateDb, tokenDOrder.order, tokenDOrder.feeRate); fee != nil && fee.Sign() != 0 {
t.Errorf("getCancelFee() = %v, want %v", fee, common.Big0) t.Errorf("getCancelFee() = %v, want %v", fee, common.Big0)
} }
} }
func TestGetTradeQuantity(t *testing.T) { func TestGetTradeQuantity(t *testing.T) {

View file

@ -129,7 +129,6 @@ func (ms *XDCXManagedState) 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.exchanges[addr] = newAccount(so) ms.exchanges[addr] = newAccount(so)
} }
} }
return ms.exchanges[addr] return ms.exchanges[addr]

View file

@ -66,7 +66,6 @@ func TestEchangeStates(t *testing.T) {
mapPriceBuy[amount] = old + amount mapPriceBuy[amount] = old + amount
default: default:
} }
} }
statedb.SetLastPrice(orderBook, price) statedb.SetLastPrice(orderBook, price)
statedb.InsertLiquidationPrice(orderBook, big.NewInt(1), orderBook, 2) statedb.InsertLiquidationPrice(orderBook, big.NewInt(1), orderBook, 2)

View file

@ -45,7 +45,6 @@ func NewBatchDatabaseWithEncode(datadir string, cacheLimit int) *BatchDatabase {
} }
return batchDB return batchDB
} }
func (db *BatchDatabase) IsEmptyKey(key []byte) bool { func (db *BatchDatabase) IsEmptyKey(key []byte) bool {

View file

@ -140,7 +140,6 @@ func runCmd(ctx *cli.Context) error {
} }
} }
code = common.Hex2Bytes(string(bytes.TrimRight(hexcode, "\n"))) code = common.Hex2Bytes(string(bytes.TrimRight(hexcode, "\n")))
} else if ctx.String(CodeFlag.Name) != "" { } else if ctx.String(CodeFlag.Name) != "" {
code = common.Hex2Bytes(ctx.String(CodeFlag.Name)) code = common.Hex2Bytes(ctx.String(CodeFlag.Name))
} else if fn := ctx.Args().First(); len(fn) > 0 { } else if fn := ctx.Args().First(); len(fn) > 0 {

View file

@ -211,7 +211,6 @@ func (x *XDPoS) VerifyHeader(chain consensus.ChainReader, header *types.Header,
// method returns a quit channel to abort the operations and a results channel to // method returns a quit channel to abort the operations and a results channel to
// retrieve the async verifications (the order is that of the input slice). // retrieve the async verifications (the order is that of the input slice).
func (x *XDPoS) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, fullVerifies []bool) (chan<- struct{}, <-chan error) { func (x *XDPoS) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, fullVerifies []bool) (chan<- struct{}, <-chan error) {
abort := make(chan struct{}) abort := make(chan struct{})
results := make(chan error, len(headers)) results := make(chan error, len(headers))

View file

@ -144,7 +144,6 @@ func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.S
}, 10000000, chainConfig) }, 10000000, chainConfig)
return contractBackend2 return contractBackend2
} }
func transferTx(t *testing.T, to common.Address, transferAmount int64) *types.Transaction { func transferTx(t *testing.T, to common.Address, transferAmount int64) *types.Transaction {
@ -201,7 +200,6 @@ func GetSnapshotSigner(bc *core.BlockChain, header *types.Header) (signersList,
ms[addr.Hex()] = true ms[addr.Hex()] = true
} }
return ms, nil return ms, nil
} }
func GetCandidateFromCurrentSmartContract(backend bind.ContractBackend, t *testing.T) masterNodes { func GetCandidateFromCurrentSmartContract(backend bind.ContractBackend, t *testing.T) masterNodes {

View file

@ -274,7 +274,6 @@ func getMultiCandidatesBackend(t *testing.T, chainConfig *params.ChainConfig, n
} }
func getProtectorObserverBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.SimulatedBackend { func getProtectorObserverBackend(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

@ -63,6 +63,7 @@ func airDropTokenToAccountNoXDC() {
log.Fatal("can't execute transferAmount in tr21:", err) log.Fatal("can't execute transferAmount in tr21:", err)
} }
} }
func testTransferTRC21TokenWithAccountNoXDC() { func testTransferTRC21TokenWithAccountNoXDC() {
client, err := ethclient.Dial(simulation.RpcEndpoint) client, err := ethclient.Dial(simulation.RpcEndpoint)
if err != nil { if err != nil {
@ -127,6 +128,7 @@ func testTransferTRC21TokenWithAccountNoXDC() {
log.Fatal("can't get balance token fee in smart contract: ", err, "got", balanceIssuerFee, "wanted", remainFee) log.Fatal("can't get balance token fee in smart contract: ", err, "got", balanceIssuerFee, "wanted", remainFee)
} }
} }
func testTransferTrc21Fail() { func testTransferTrc21Fail() {
client, err := ethclient.Dial(simulation.RpcEndpoint) client, err := ethclient.Dial(simulation.RpcEndpoint)
if err != nil { if err != nil {
@ -192,8 +194,8 @@ func testTransferTrc21Fail() {
if err != nil || balance.Cmp(remainFee) != 0 { if err != nil || balance.Cmp(remainFee) != 0 {
log.Fatal("can't get balance token fee in smart contract: ", err, "got", balanceIssuerFee, "wanted", remainFee) log.Fatal("can't get balance token fee in smart contract: ", err, "got", balanceIssuerFee, "wanted", remainFee)
} }
} }
func main() { func main() {
fmt.Println("========================") fmt.Println("========================")
fmt.Println("airdropAddr", simulation.AirdropAddr.Hex()) fmt.Println("airdropAddr", simulation.AirdropAddr.Hex())

View file

@ -178,7 +178,6 @@ func TestRewardBalance(t *testing.T) {
t.Errorf("reward total %v - %v", totalReward, afterReward) t.Errorf("reward total %v - %v", totalReward, afterReward)
} }
} }
func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.XDCValidator) (map[common.Address]*big.Int, error) { func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.XDCValidator) (map[common.Address]*big.Int, error) {

View file

@ -964,7 +964,6 @@ func (pool *LendingPool) promoteExecutables(accounts []common.Address) {
hash := tx.Hash() hash := tx.Hash()
log.Trace("Removed old queued transaction", "hash", hash) log.Trace("Removed old queued transaction", "hash", hash)
delete(pool.all, hash) delete(pool.all, hash)
} }
// Gather all executable transactions and promote them // Gather all executable transactions and promote them

View file

@ -110,5 +110,4 @@ func (l *LendingMsg) computeHash() common.Hash {
} }
return common.BytesToHash(sha.Sum(nil)) return common.BytesToHash(sha.Sum(nil))
} }

View file

@ -483,7 +483,6 @@ func (pool *OrderPool) validateOrder(tx *types.OrderTransaction) error {
return err return err
} }
} }
} }
if orderStatus != OrderStatusNew && orderStatus != OrderStatusCancle { if orderStatus != OrderStatusNew && orderStatus != OrderStatusCancle {

View file

@ -560,7 +560,6 @@ func (d *Downloader) Terminate() {
// fetchHeight retrieves the head header of the remote peer to aid in estimating // fetchHeight retrieves the head header of the remote peer to aid in estimating
// the total time a pending synchronisation would take. // the total time a pending synchronisation would take.
func (d *Downloader) fetchHeight(p *peerConnection, hash common.Hash) (*types.Header, error) { func (d *Downloader) fetchHeight(p *peerConnection, hash common.Hash) (*types.Header, error) {
// Request the advertised remote head block and wait for the response // Request the advertised remote head block and wait for the response
go p.peer.RequestHeadersByHash(hash, 1, 0, false) go p.peer.RequestHeadersByHash(hash, 1, 0, false)
@ -1121,7 +1120,6 @@ func (d *Downloader) fetchParts(deliveryCh chan dataPack, deliver func(dataPack)
expire func() map[string]int, pending func() int, inFlight func() bool, reserve func(*peerConnection, int) (*fetchRequest, bool, bool), expire func() map[string]int, pending func() int, inFlight func() bool, reserve func(*peerConnection, int) (*fetchRequest, bool, bool),
fetchHook func([]*types.Header), fetch func(*peerConnection, *fetchRequest) error, cancel func(*fetchRequest), capacity func(*peerConnection) int, fetchHook func([]*types.Header), fetch func(*peerConnection, *fetchRequest) error, cancel func(*fetchRequest), capacity func(*peerConnection) int,
idle func() ([]*peerConnection, int), setIdle func(*peerConnection, int, time.Time), kind string) error { idle func() ([]*peerConnection, int), setIdle func(*peerConnection, int, time.Time), kind string) error {
// Create a ticker to detect expired retrieval tasks // Create a ticker to detect expired retrieval tasks
ticker := time.NewTicker(100 * time.Millisecond) ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop() defer ticker.Stop()

View file

@ -831,7 +831,6 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
taskQueue *prque.Prque[int64, *types.Header], pendPool map[string]*fetchRequest, reqTimer *metrics.Timer, taskQueue *prque.Prque[int64, *types.Header], pendPool map[string]*fetchRequest, reqTimer *metrics.Timer,
results int, validate func(index int, header *types.Header) error, results int, validate func(index int, header *types.Header) error,
reconstruct func(index int, result *fetchResult)) (int, error) { reconstruct func(index int, result *fetchResult)) (int, error) {
// Short circuit if the data was never requested // Short circuit if the data was never requested
request := pendPool[id] request := pendPool[id]
if request == nil { if request == nil {

View file

@ -389,10 +389,9 @@ func (n *network) forget(blocknum uint64) {
n.chain = n.chain[index:] n.chain = n.chain[index:]
n.receipts = n.receipts[index:] n.receipts = n.receipts[index:]
n.offset = int(blocknum) n.offset = int(blocknum)
} }
func (n *network) progress(numBlocks int) {
func (n *network) progress(numBlocks int) {
n.lock.Lock() n.lock.Lock()
defer n.lock.Unlock() defer n.lock.Unlock()
//fmt.Printf("progressing...\n") //fmt.Printf("progressing...\n")
@ -400,7 +399,6 @@ func (n *network) progress(numBlocks int) {
n.chain = append(n.chain, newBlocks...) n.chain = append(n.chain, newBlocks...)
n.receipts = append(n.receipts, newR...) n.receipts = append(n.receipts, newR...)
n.cond.Broadcast() n.cond.Broadcast()
} }
func (n *network) headers(from int) []*types.Header { func (n *network) headers(from int) []*types.Header {

View file

@ -562,7 +562,6 @@ func (f *Fetcher) loop() {
} else { } else {
f.forgetHash(hash) f.forgetHash(hash)
} }
} }
if matched { if matched {
task.transactions = append(task.transactions[:i], task.transactions[i+1:]...) task.transactions = append(task.transactions[:i], task.transactions[i+1:]...)

View file

@ -63,5 +63,4 @@ func TestParseEthstatsURL(t *testing.T) {
t.Errorf("case=%d mismatch host value, got: %v ,want: %v", i, host, c.host) t.Errorf("case=%d mismatch host value, got: %v ,want: %v", i, host, c.host)
} }
} }
} }