diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-05-23 16:18:06 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-06-07 11:35:16 -0700 |
commit | 2fcd9cc86bfce944e3312e9a24685403250f3bdc (patch) | |
tree | 7aafcf14463ac2d6eabbc732c252d125a1b9ed1a /src/test/sighash_tests.cpp | |
parent | 2ada67852174a76753080d65a7adbe27241a9caa (diff) |
scripted-diff: Use randbits/bool instead of randrange where possible
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_randbits(1)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(2)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(4)/insecure_randbits(2)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(32)/insecure_randbits(5)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(256)/insecure_randbits(8)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
Diffstat (limited to 'src/test/sighash_tests.cpp')
-rw-r--r-- | src/test/sighash_tests.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 805c09c1a4..b8d6bdd730 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -98,16 +98,16 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle) { tx.nVersion = insecure_rand(); tx.vin.clear(); tx.vout.clear(); - tx.nLockTime = (insecure_randrange(2)) ? insecure_rand() : 0; - int ins = (insecure_randrange(4)) + 1; - int outs = fSingle ? ins : (insecure_randrange(4)) + 1; + tx.nLockTime = (insecure_randbool()) ? insecure_rand() : 0; + int ins = (insecure_randbits(2)) + 1; + int outs = fSingle ? ins : (insecure_randbits(2)) + 1; for (int in = 0; in < ins; in++) { tx.vin.push_back(CTxIn()); CTxIn &txin = tx.vin.back(); txin.prevout.hash = insecure_rand256(); - txin.prevout.n = insecure_randrange(4); + txin.prevout.n = insecure_randbits(2); RandomScript(txin.scriptSig); - txin.nSequence = (insecure_randrange(2)) ? insecure_rand() : (unsigned int)-1; + txin.nSequence = (insecure_randbool()) ? insecure_rand() : (unsigned int)-1; } for (int out = 0; out < outs; out++) { tx.vout.push_back(CTxOut()); |