diff --git a/blockchain/pool_test.go b/blockchain/pool_test.go index 0856a3714..3e347fd29 100644 --- a/blockchain/pool_test.go +++ b/blockchain/pool_test.go @@ -23,7 +23,7 @@ func makePeers(numPeers int, minHeight, maxHeight int64) map[string]testPeer { peers := make(map[string]testPeer, numPeers) for i := 0; i < numPeers; i++ { peerID := cmn.RandStr(12) - height := minHeight + int64(rand.Intn(int(maxHeight-minHeight))) + height := minHeight + rand.Int63n(maxHeight-minHeight) peers[peerID] = testPeer{peerID, height} } return peers diff --git a/rpc/core/blocks.go b/rpc/core/blocks.go index a06ba83ec..9d4098459 100644 --- a/rpc/core/blocks.go +++ b/rpc/core/blocks.go @@ -74,9 +74,7 @@ func BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, e // maximum 20 block metas const limit int64 = 20 - if maxHeight >= limit { // to prevent underflow - minHeight = cmn.MaxInt64(minHeight, maxHeight-limit) - } + minHeight = cmn.MaxInt64(minHeight, maxHeight-limit) logger.Debug("BlockchainInfoHandler", "maxHeight", maxHeight, "minHeight", minHeight) diff --git a/rpc/core/tx.go b/rpc/core/tx.go index 0aa9f2149..d0ff68402 100644 --- a/rpc/core/tx.go +++ b/rpc/core/tx.go @@ -88,8 +88,8 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) { var proof types.TxProof if prove { - // TODO: handle overflow block := blockStore.LoadBlock(height) + // TODO: handle overflow proof = block.Data.Txs.Proof(index) } @@ -187,8 +187,8 @@ func TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error) { index := r.Index if prove { - // TODO: handle overflow block := blockStore.LoadBlock(height) + // TODO: handle overflow proof = block.Data.Txs.Proof(int(index)) } diff --git a/types/validator_set.go b/types/validator_set.go index cba9f206f..134e4e06e 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -53,7 +53,7 @@ func (valSet *ValidatorSet) IncrementAccum(times int) { // Add VotingPower * times to each validator and order into heap. validatorsHeap := cmn.NewHeap() for _, val := range valSet.Validators { - val.Accum += int64(val.VotingPower) * int64(times) // TODO: mind overflow + val.Accum += val.VotingPower * int64(times) // TODO: mind overflow validatorsHeap.Push(val, accumComparable{val}) }