libs/common: refactor libs/common 2 (#4231)

* libs/common: refactor libs/common 2

- move random function to there own pkg

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* change imports and usage throughout repo

* fix goimports

* add changelog entry
This commit is contained in:
Marko
2019-12-10 18:38:34 +01:00
committed by GitHub
parent dfebac86f7
commit afc4d7a61f
55 changed files with 221 additions and 196 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ import (
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/lite2/provider"
"github.com/tendermint/tendermint/lite2/store"
"github.com/tendermint/tendermint/types"
@@ -421,7 +422,7 @@ func (c *Client) fetchHeaderAndValsAtHeight(height int64) (*types.SignedHeader,
func (c *Client) compareNewHeaderWithRandomAlternative(h *types.SignedHeader) error {
// 1. Pick an alternative provider.
p := c.alternatives[cmn.RandIntn(len(c.alternatives))]
p := c.alternatives[rand.RandIntn(len(c.alternatives))]
// 2. Fetch the header.
altHeader, err := p.SignedHeader(h.Height)