txscript/hashcache_test: always add inputs during getTxn
TestHashCacheAddContainsHashes flakes fairly regularly when rebasing PR #1684 with: txid <txid> wasn't inserted into cache but was found. With probabilty 1/10^2 there will be no inputs on the transaction. This reduces the entropy in the txid, and I belive is the primary cause of the flake.
This commit is contained in:
parent
77fd96753c
commit
1dd693480c
1 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ 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 +34,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(),
|
||||
|
|
Loading…
Reference in a new issue