From 2b658e793411670cc480d5bbd15ebd5ec613b268 Mon Sep 17 00:00:00 2001 From: wit liu <765765346@qq.com> Date: Wed, 24 Sep 2025 07:55:14 +0800 Subject: [PATCH] core: fix unnecessary conversion (#1565) --- cmd/puppeth/wizard_genesis.go | 4 ++-- core/blockchain_test.go | 2 +- core/txpool/lending_pool_test.go | 2 +- core/txpool/order_pool_test.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/puppeth/wizard_genesis.go b/cmd/puppeth/wizard_genesis.go index 8abc778090..2a72d09759 100644 --- a/cmd/puppeth/wizard_genesis.go +++ b/cmd/puppeth/wizard_genesis.go @@ -291,7 +291,7 @@ func (w *wizard) makeGenesis() { fmt.Println() fmt.Println("How many blocks before checkpoint need to prepare new set of masternodes? (default = 450)") if input != nil { - genesis.Config.XDPoS.Gap = uint64(input.Gap) + genesis.Config.XDPoS.Gap = input.Gap } else { genesis.Config.XDPoS.Gap = uint64(w.readDefaultInt(450)) } @@ -314,7 +314,7 @@ func (w *wizard) makeGenesis() { } else { yield = uint64(w.readDefaultInt(10)) } - blocksPerYear := uint64(31536000 / genesis.Config.XDPoS.Period) + blocksPerYear := 31536000 / genesis.Config.XDPoS.Period epochsPerYear := blocksPerYear / genesis.Config.XDPoS.Epoch rewardsPerYear := float64(threshold) * (float64(yield) / float64(100)) rewardPerEpochPerMN := uint64(rewardsPerYear / float64(epochsPerYear)) diff --git a/core/blockchain_test.go b/core/blockchain_test.go index a0d39d8d7a..ff15201ef9 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -130,7 +130,7 @@ func testFork(t *testing.T, blockchain *BlockChain, i, n int, full bool, compara func printChain(bc *BlockChain) { for i := bc.CurrentBlock().Number().Uint64(); i > 0; i-- { - b := bc.GetBlockByNumber(uint64(i)) + b := bc.GetBlockByNumber(i) fmt.Printf("\t%x %v\n", b.Hash(), b.Difficulty()) } } diff --git a/core/txpool/lending_pool_test.go b/core/txpool/lending_pool_test.go index fff43d190c..5df416f61e 100644 --- a/core/txpool/lending_pool_test.go +++ b/core/txpool/lending_pool_test.go @@ -58,7 +58,7 @@ func getLendingNonce(userAddress common.Address) (uint64, error) { s := result.(string) s = strings.TrimPrefix(s, "0x") n, err := strconv.ParseUint(s, 16, 32) - return uint64(n), err + return n, err } func (l *LendingMsg) computeHash() common.Hash { diff --git a/core/txpool/order_pool_test.go b/core/txpool/order_pool_test.go index c5e1618561..96a18d0e66 100644 --- a/core/txpool/order_pool_test.go +++ b/core/txpool/order_pool_test.go @@ -67,7 +67,7 @@ func getNonce(t *testing.T, userAddress common.Address) (uint64, error) { s := result.(string) s = strings.TrimPrefix(s, "0x") n, err := strconv.ParseUint(s, 16, 32) - return uint64(n), err + return n, err } func testSendOrder(t *testing.T, amount, price *big.Int, side string, status string, orderID uint64) {