mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
refactor tests to fix ubsan suppressions
This commit is contained in:
@@ -91,8 +91,9 @@ void static RandomScript(CScript &script) {
|
||||
script << oplist[InsecureRandRange(std::size(oplist))];
|
||||
}
|
||||
|
||||
void static RandomTransaction(CMutableTransaction &tx, bool fSingle) {
|
||||
tx.nVersion = InsecureRand32();
|
||||
void static RandomTransaction(CMutableTransaction& tx, bool fSingle)
|
||||
{
|
||||
tx.nVersion = int(InsecureRand32());
|
||||
tx.vin.clear();
|
||||
tx.vout.clear();
|
||||
tx.nLockTime = (InsecureRandBool()) ? InsecureRand32() : 0;
|
||||
@@ -126,7 +127,7 @@ BOOST_AUTO_TEST_CASE(sighash_test)
|
||||
int nRandomTests = 50000;
|
||||
#endif
|
||||
for (int i=0; i<nRandomTests; i++) {
|
||||
int nHashType = InsecureRand32();
|
||||
int nHashType{int(InsecureRand32())};
|
||||
CMutableTransaction txTo;
|
||||
RandomTransaction(txTo, (nHashType & 0x1f) == SIGHASH_SINGLE);
|
||||
CScript scriptCode;
|
||||
|
||||
Reference in New Issue
Block a user