diff options
Diffstat (limited to 'src/test/sighash_tests.cpp')
-rw-r--r-- | src/test/sighash_tests.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index b8d6bdd730..d882ca7a63 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -89,30 +89,30 @@ uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, un void static RandomScript(CScript &script) { static const opcodetype oplist[] = {OP_FALSE, OP_1, OP_2, OP_3, OP_CHECKSIG, OP_IF, OP_VERIF, OP_RETURN, OP_CODESEPARATOR}; script = CScript(); - int ops = (insecure_randrange(10)); + int ops = (InsecureRandRange(10)); for (int i=0; i<ops; i++) - script << oplist[insecure_randrange(sizeof(oplist)/sizeof(oplist[0]))]; + script << oplist[InsecureRandRange(sizeof(oplist)/sizeof(oplist[0]))]; } void static RandomTransaction(CMutableTransaction &tx, bool fSingle) { - tx.nVersion = insecure_rand(); + tx.nVersion = InsecureRand32(); tx.vin.clear(); tx.vout.clear(); - tx.nLockTime = (insecure_randbool()) ? insecure_rand() : 0; - int ins = (insecure_randbits(2)) + 1; - int outs = fSingle ? ins : (insecure_randbits(2)) + 1; + tx.nLockTime = (InsecureRandBool()) ? InsecureRand32() : 0; + int ins = (InsecureRandBits(2)) + 1; + int outs = fSingle ? ins : (InsecureRandBits(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_randbits(2); + txin.prevout.hash = InsecureRand256(); + txin.prevout.n = InsecureRandBits(2); RandomScript(txin.scriptSig); - txin.nSequence = (insecure_randbool()) ? insecure_rand() : (unsigned int)-1; + txin.nSequence = (InsecureRandBool()) ? InsecureRand32() : (unsigned int)-1; } for (int out = 0; out < outs; out++) { tx.vout.push_back(CTxOut()); CTxOut &txout = tx.vout.back(); - txout.nValue = insecure_randrange(100000000); + txout.nValue = InsecureRandRange(100000000); RandomScript(txout.scriptPubKey); } } @@ -121,7 +121,7 @@ BOOST_FIXTURE_TEST_SUITE(sighash_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(sighash_test) { - seed_insecure_rand(false); + SeedInsecureRand(false); #if defined(PRINT_SIGHASH_JSON) std::cout << "[\n"; @@ -133,12 +133,12 @@ BOOST_AUTO_TEST_CASE(sighash_test) nRandomTests = 500; #endif for (int i=0; i<nRandomTests; i++) { - int nHashType = insecure_rand(); + int nHashType = InsecureRand32(); CMutableTransaction txTo; RandomTransaction(txTo, (nHashType & 0x1f) == SIGHASH_SINGLE); CScript scriptCode; RandomScript(scriptCode); - int nIn = insecure_randrange(txTo.vin.size()); + int nIn = InsecureRandRange(txTo.vin.size()); uint256 sh, sho; sho = SignatureHashOld(scriptCode, txTo, nIn, nHashType); |