From 124d13a58cdcd9f66eeffc7e6281e3eb129e3398 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 23 May 2017 15:09:30 -0700 Subject: Merge test_random.h into test_bitcoin.h --- src/test/sighash_tests.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/test/sighash_tests.cpp') diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 2f7c22084e..f796216e5f 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -11,7 +11,6 @@ #include "serialize.h" #include "streams.h" #include "test/test_bitcoin.h" -#include "test/test_random.h" #include "util.h" #include "utilstrencodings.h" #include "version.h" -- cgit v1.2.3 From efee1db21a652019e0ab18fffc233d91bb7f1816 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 23 May 2017 15:28:45 -0700 Subject: scripted-diff: use insecure_rand256/randrange more -BEGIN VERIFY SCRIPT- sed -i "s/\ Date: Wed, 7 Jun 2017 11:34:55 -0700 Subject: Replace more rand() % NUM by randranges --- src/test/sighash_tests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test/sighash_tests.cpp') diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 564fc6b944..805c09c1a4 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -91,7 +91,7 @@ void static RandomScript(CScript &script) { script = CScript(); int ops = (insecure_randrange(10)); for (int i=0; i Date: Tue, 23 May 2017 16:18:06 -0700 Subject: 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- --- src/test/sighash_tests.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/test/sighash_tests.cpp') 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()); -- cgit v1.2.3 From e945848582160b23fa0bc6f797e2bd8ac676ee0e Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 7 Jun 2017 12:03:17 -0700 Subject: scripted-diff: Use new naming style for insecure_rand* functions -BEGIN VERIFY SCRIPT- sed -i 's/\