refactor tests to fix ubsan suppressions

This commit is contained in:
MarcoFalke
2022-01-02 16:53:02 +01:00
parent 1824644a36
commit faedb111d2
8 changed files with 25 additions and 34 deletions

View File

@@ -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;