diff --git a/txscript/hashcache_test.go b/txscript/hashcache_test.go index 389918e2f2..cee59b9956 100644 --- a/txscript/hashcache_test.go +++ b/txscript/hashcache_test.go @@ -13,12 +13,16 @@ import ( "github.com/davecgh/go-spew/spew" ) +func init() { + rand.Seed(time.Now().Unix()) +} + // genTestTx creates a random transaction for uses within test cases. func genTestTx() (*wire.MsgTx, error) { tx := wire.NewMsgTx(2) tx.Version = rand.Int31() - numTxins := rand.Intn(11) + numTxins := 1 + rand.Intn(11) for i := 0; i < numTxins; i++ { randTxIn := wire.TxIn{ PreviousOutPoint: wire.OutPoint{ @@ -34,7 +38,7 @@ func genTestTx() (*wire.MsgTx, error) { tx.TxIn = append(tx.TxIn, &randTxIn) } - numTxouts := rand.Intn(11) + numTxouts := 1 + rand.Intn(11) for i := 0; i < numTxouts; i++ { randTxOut := wire.TxOut{ Value: rand.Int63(), @@ -56,8 +60,6 @@ func genTestTx() (*wire.MsgTx, error) { func TestHashCacheAddContainsHashes(t *testing.T) { t.Parallel() - rand.Seed(time.Now().Unix()) - cache := NewHashCache(10) var err error @@ -109,8 +111,6 @@ func TestHashCacheAddContainsHashes(t *testing.T) { func TestHashCacheAddGet(t *testing.T) { t.Parallel() - rand.Seed(time.Now().Unix()) - cache := NewHashCache(10) // To start, we'll generate a random transaction and compute the set of @@ -144,8 +144,6 @@ func TestHashCacheAddGet(t *testing.T) { func TestHashCachePurge(t *testing.T) { t.Parallel() - rand.Seed(time.Now().Unix()) - cache := NewHashCache(10) var err error