diff options
| author | Gavin Andresen <[email protected]> | 2012-05-17 12:13:14 -0400 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2012-06-19 15:22:58 -0400 |
| commit | 28a498d5a6794bce952fe8a1938720b73946c1d8 (patch) | |
| tree | cdf6d607a5699957f93c02e18ed6e60fb9cd8444 /src/test | |
| parent | Cache signature verifications (diff) | |
| download | discoin-28a498d5a6794bce952fe8a1938720b73946c1d8.tar.xz discoin-28a498d5a6794bce952fe8a1938720b73946c1d8.zip | |
Refactor: GetRandHash() method for util
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/DoS_tests.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp index 2e418b3a1..4ee2e9483 100644 --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -132,18 +132,10 @@ BOOST_AUTO_TEST_CASE(DoS_checknbits) } -static uint256 RandomHash() -{ - std::vector<unsigned char> randbytes(32); - RAND_bytes(&randbytes[0], 32); - uint256 randomhash(randbytes); - return randomhash; -} - CTransaction RandomOrphan() { std::map<uint256, CDataStream*>::iterator it; - it = mapOrphanTransactions.lower_bound(RandomHash()); + it = mapOrphanTransactions.lower_bound(GetRandHash()); if (it == mapOrphanTransactions.end()) it = mapOrphanTransactions.begin(); const CDataStream* pvMsg = it->second; @@ -165,7 +157,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans) CTransaction tx; tx.vin.resize(1); tx.vin[0].prevout.n = 0; - tx.vin[0].prevout.hash = RandomHash(); + tx.vin[0].prevout.hash = GetRandHash(); tx.vin[0].scriptSig << OP_1; tx.vout.resize(1); tx.vout[0].nValue = 1*CENT; |