diff options
Diffstat (limited to 'src/test/sighash_tests.cpp')
-rw-r--r-- | src/test/sighash_tests.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index f796216e5f..564fc6b944 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -89,7 +89,7 @@ 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_rand() % 10); + int ops = (insecure_randrange(10)); for (int i=0; i<ops; i++) script << oplist[insecure_rand() % (sizeof(oplist)/sizeof(oplist[0]))]; } @@ -98,21 +98,21 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle) { tx.nVersion = insecure_rand(); tx.vin.clear(); tx.vout.clear(); - tx.nLockTime = (insecure_rand() % 2) ? insecure_rand() : 0; - int ins = (insecure_rand() % 4) + 1; - int outs = fSingle ? ins : (insecure_rand() % 4) + 1; + tx.nLockTime = (insecure_randrange(2)) ? insecure_rand() : 0; + int ins = (insecure_randrange(4)) + 1; + int outs = fSingle ? ins : (insecure_randrange(4)) + 1; for (int in = 0; in < ins; in++) { tx.vin.push_back(CTxIn()); CTxIn &txin = tx.vin.back(); - txin.prevout.hash = GetRandHash(); - txin.prevout.n = insecure_rand() % 4; + txin.prevout.hash = insecure_rand256(); + txin.prevout.n = insecure_randrange(4); RandomScript(txin.scriptSig); - txin.nSequence = (insecure_rand() % 2) ? insecure_rand() : (unsigned int)-1; + txin.nSequence = (insecure_randrange(2)) ? insecure_rand() : (unsigned int)-1; } for (int out = 0; out < outs; out++) { tx.vout.push_back(CTxOut()); CTxOut &txout = tx.vout.back(); - txout.nValue = insecure_rand() % 100000000; + txout.nValue = insecure_randrange(100000000); RandomScript(txout.scriptPubKey); } } |