diff --git a/XDCx/order_processor_test.go b/XDCx/order_processor_test.go index 214ff77496..60837316f9 100644 --- a/XDCx/order_processor_test.go +++ b/XDCx/order_processor_test.go @@ -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 { t.Errorf("getCancelFee() = %v, want %v", fee, common.Big0) } - } func TestGetTradeQuantity(t *testing.T) { diff --git a/XDCx/tradingstate/managed_state.go b/XDCx/tradingstate/managed_state.go index a21876aee2..7e348dde60 100644 --- a/XDCx/tradingstate/managed_state.go +++ b/XDCx/tradingstate/managed_state.go @@ -129,7 +129,6 @@ func (ms *XDCXManagedState) getAccount(addr common.Hash) *exchanges { if so != nil && uint64(len(account.nonces))+account.nstart < so.Nonce() { ms.exchanges[addr] = newAccount(so) } - } return ms.exchanges[addr] diff --git a/XDCx/tradingstate/statedb_test.go b/XDCx/tradingstate/statedb_test.go index 44123c8d60..30eaef35c0 100644 --- a/XDCx/tradingstate/statedb_test.go +++ b/XDCx/tradingstate/statedb_test.go @@ -66,7 +66,6 @@ func TestEchangeStates(t *testing.T) { mapPriceBuy[amount] = old + amount default: } - } statedb.SetLastPrice(orderBook, price) statedb.InsertLiquidationPrice(orderBook, big.NewInt(1), orderBook, 2) diff --git a/XDCxDAO/leveldb.go b/XDCxDAO/leveldb.go index 195bbfdb97..7d99ea7e1c 100644 --- a/XDCxDAO/leveldb.go +++ b/XDCxDAO/leveldb.go @@ -45,7 +45,6 @@ func NewBatchDatabaseWithEncode(datadir string, cacheLimit int) *BatchDatabase { } return batchDB - } func (db *BatchDatabase) IsEmptyKey(key []byte) bool { diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index a6aa554ba9..462fab8b4e 100644 --- a/cmd/evm/runner.go +++ b/cmd/evm/runner.go @@ -140,7 +140,6 @@ func runCmd(ctx *cli.Context) error { } } code = common.Hex2Bytes(string(bytes.TrimRight(hexcode, "\n"))) - } else if ctx.String(CodeFlag.Name) != "" { code = common.Hex2Bytes(ctx.String(CodeFlag.Name)) } else if fn := ctx.Args().First(); len(fn) > 0 { diff --git a/consensus/XDPoS/XDPoS.go b/consensus/XDPoS/XDPoS.go index 66c621afd2..a9e20b4c42 100644 --- a/consensus/XDPoS/XDPoS.go +++ b/consensus/XDPoS/XDPoS.go @@ -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 // 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) { - abort := make(chan struct{}) results := make(chan error, len(headers)) diff --git a/consensus/tests/engine_v1_tests/helper.go b/consensus/tests/engine_v1_tests/helper.go index 99d862372f..04302b3a09 100644 --- a/consensus/tests/engine_v1_tests/helper.go +++ b/consensus/tests/engine_v1_tests/helper.go @@ -144,7 +144,6 @@ func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.S }, 10000000, chainConfig) return contractBackend2 - } 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 } return ms, nil - } func GetCandidateFromCurrentSmartContract(backend bind.ContractBackend, t *testing.T) masterNodes { diff --git a/consensus/tests/engine_v2_tests/helper.go b/consensus/tests/engine_v2_tests/helper.go index 439de41f2a..74cbe9970d 100644 --- a/consensus/tests/engine_v2_tests/helper.go +++ b/consensus/tests/engine_v2_tests/helper.go @@ -274,7 +274,6 @@ func getMultiCandidatesBackend(t *testing.T, chainConfig *params.ChainConfig, n } func getProtectorObserverBackend(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/contracts/trc21issuer/simulation/test/main.go b/contracts/trc21issuer/simulation/test/main.go index 489a7e24ef..3db25c4ca3 100644 --- a/contracts/trc21issuer/simulation/test/main.go +++ b/contracts/trc21issuer/simulation/test/main.go @@ -63,6 +63,7 @@ func airDropTokenToAccountNoXDC() { log.Fatal("can't execute transferAmount in tr21:", err) } } + func testTransferTRC21TokenWithAccountNoXDC() { client, err := ethclient.Dial(simulation.RpcEndpoint) 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) } } + func testTransferTrc21Fail() { client, err := ethclient.Dial(simulation.RpcEndpoint) if err != nil { @@ -192,8 +194,8 @@ func testTransferTrc21Fail() { if err != nil || balance.Cmp(remainFee) != 0 { log.Fatal("can't get balance token fee in smart contract: ", err, "got", balanceIssuerFee, "wanted", remainFee) } - } + func main() { fmt.Println("========================") fmt.Println("airdropAddr", simulation.AirdropAddr.Hex()) diff --git a/contracts/validator/validator_test.go b/contracts/validator/validator_test.go index a52bae3f98..6920dddb23 100644 --- a/contracts/validator/validator_test.go +++ b/contracts/validator/validator_test.go @@ -178,7 +178,6 @@ func TestRewardBalance(t *testing.T) { 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) { diff --git a/core/txpool/lending_pool.go b/core/txpool/lending_pool.go index 3dbdf816e2..6c1019b7c2 100644 --- a/core/txpool/lending_pool.go +++ b/core/txpool/lending_pool.go @@ -964,7 +964,6 @@ func (pool *LendingPool) promoteExecutables(accounts []common.Address) { hash := tx.Hash() log.Trace("Removed old queued transaction", "hash", hash) delete(pool.all, hash) - } // Gather all executable transactions and promote them diff --git a/core/txpool/lending_pool_test.go b/core/txpool/lending_pool_test.go index 08ad4d8cd1..c49e679f70 100644 --- a/core/txpool/lending_pool_test.go +++ b/core/txpool/lending_pool_test.go @@ -110,5 +110,4 @@ func (l *LendingMsg) computeHash() common.Hash { } return common.BytesToHash(sha.Sum(nil)) - } diff --git a/core/txpool/order_pool.go b/core/txpool/order_pool.go index 23bc6f6ac0..44331ecafe 100644 --- a/core/txpool/order_pool.go +++ b/core/txpool/order_pool.go @@ -483,7 +483,6 @@ func (pool *OrderPool) validateOrder(tx *types.OrderTransaction) error { return err } } - } if orderStatus != OrderStatusNew && orderStatus != OrderStatusCancle { diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 3986e1833b..b48e7a94c3 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -560,7 +560,6 @@ func (d *Downloader) Terminate() { // fetchHeight retrieves the head header of the remote peer to aid in estimating // the total time a pending synchronisation would take. func (d *Downloader) fetchHeight(p *peerConnection, hash common.Hash) (*types.Header, error) { - // Request the advertised remote head block and wait for the response 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), 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 { - // Create a ticker to detect expired retrieval tasks ticker := time.NewTicker(100 * time.Millisecond) defer ticker.Stop() diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go index 37638097ae..ab6dfc05bf 100644 --- a/eth/downloader/queue.go +++ b/eth/downloader/queue.go @@ -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, results int, validate func(index int, header *types.Header) error, reconstruct func(index int, result *fetchResult)) (int, error) { - // Short circuit if the data was never requested request := pendPool[id] if request == nil { diff --git a/eth/downloader/queue_test.go b/eth/downloader/queue_test.go index 3530fd64ad..e52bcdb49c 100644 --- a/eth/downloader/queue_test.go +++ b/eth/downloader/queue_test.go @@ -389,10 +389,9 @@ func (n *network) forget(blocknum uint64) { n.chain = n.chain[index:] n.receipts = n.receipts[index:] n.offset = int(blocknum) - } -func (n *network) progress(numBlocks int) { +func (n *network) progress(numBlocks int) { n.lock.Lock() defer n.lock.Unlock() //fmt.Printf("progressing...\n") @@ -400,7 +399,6 @@ func (n *network) progress(numBlocks int) { n.chain = append(n.chain, newBlocks...) n.receipts = append(n.receipts, newR...) n.cond.Broadcast() - } func (n *network) headers(from int) []*types.Header { diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index 722392a945..174d5eb9d9 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -562,7 +562,6 @@ func (f *Fetcher) loop() { } else { f.forgetHash(hash) } - } if matched { task.transactions = append(task.transactions[:i], task.transactions[i+1:]...) diff --git a/ethstats/ethstats_test.go b/ethstats/ethstats_test.go index 92cec50c4d..3b4d08e8ad 100644 --- a/ethstats/ethstats_test.go +++ b/ethstats/ethstats_test.go @@ -63,5 +63,4 @@ func TestParseEthstatsURL(t *testing.T) { t.Errorf("case=%d mismatch host value, got: %v ,want: %v", i, host, c.host) } } - }