| 92 | } |
| 93 | |
| 94 | void static RandomTransaction(CMutableTransaction& tx, bool fSingle) |
| 95 | { |
| 96 | tx.nVersion = int(InsecureRand32()); |
| 97 | tx.vin.clear(); |
| 98 | tx.vout.clear(); |
| 99 | tx.nLockTime = (InsecureRandBool()) ? InsecureRand32() : 0; |
| 100 | int ins = (InsecureRandBits(2)) + 1; |
| 101 | int outs = fSingle ? ins : (InsecureRandBits(2)) + 1; |
| 102 | for (int in = 0; in < ins; in++) { |
| 103 | tx.vin.push_back(CTxIn()); |
| 104 | CTxIn &txin = tx.vin.back(); |
| 105 | txin.prevout.hash = InsecureRand256(); |
| 106 | txin.prevout.n = InsecureRandBits(2); |
| 107 | RandomScript(txin.scriptSig); |
| 108 | txin.nSequence = (InsecureRandBool()) ? InsecureRand32() : std::numeric_limits<uint32_t>::max(); |
| 109 | } |
| 110 | for (int out = 0; out < outs; out++) { |
| 111 | tx.vout.push_back(CTxOut()); |
| 112 | CTxOut &txout = tx.vout.back(); |
| 113 | txout.nValue = InsecureRandRange(100000000); |
| 114 | RandomScript(txout.scriptPubKey); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | BOOST_FIXTURE_TEST_SUITE(sighash_tests, BasicTestingSetup) |
| 119 |
no test coverage detected