mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 09:50:08 +01:00
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
@ -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 New Issue
Block a user