Merge bitcoin/bitcoin#24237: test: Avoid testing negative block heights

fad81548fa03861c244397201d6b6e6cbf883c38 test: Avoid testing negative block heights (MarcoFalke)

Pull request description:

  A negative chain height is only used to denote an empty chain, not the height of any block.

  So stop testing that and remove a suppression.

ACKs for top commit:
  brunoerg:
    crACK fad81548fa03861c244397201d6b6e6cbf883c38

Tree-SHA512: 0f9e91617dfb6ceda99831e6cf4b4bf0d951054957c159b1a05a178ab6090798fae7368edefe12800da24585bcdf7299ec3534f4d3bbf5ce6a6eca74dd3bb766
This commit is contained in:
MarcoFalke 2022-02-07 14:03:49 +01:00 committed by Vijay
parent f9d044d5ec
commit abfa8c0bd4
No known key found for this signature in database
GPG Key ID: E38DD2EE8F0967B1
3 changed files with 4 additions and 5 deletions

View File

@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
tx.vout.resize(1); tx.vout.resize(1);
tx.vout[0].nValue = i; //Keep txs unique unless intended to duplicate tx.vout[0].nValue = i; //Keep txs unique unless intended to duplicate
tx.vout[0].scriptPubKey.assign(InsecureRand32() & 0x3F, 0); // Random sizes so we can test memory usage accounting tx.vout[0].scriptPubKey.assign(InsecureRand32() & 0x3F, 0); // Random sizes so we can test memory usage accounting
unsigned int height = InsecureRand32(); const int height{int(InsecureRand32() >> 1)};
Coin old_coin; Coin old_coin;
// 2/20 times create a new coinbase // 2/20 times create a new coinbase
@ -403,11 +403,11 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
// Update the expected result to know about the new output coins // Update the expected result to know about the new output coins
assert(tx.vout.size() == 1); assert(tx.vout.size() == 1);
const COutPoint outpoint(tx.GetHash(), 0); const COutPoint outpoint(tx.GetHash(), 0);
result[outpoint] = Coin(tx.vout[0], height, CTransaction(tx).IsCoinBase()); result[outpoint] = Coin(tx.vout[0], height, CTransaction{tx}.IsCoinBase());
// Call UpdateCoins on the top cache // Call UpdateCoins on the top cache
CTxUndo undo; CTxUndo undo;
UpdateCoins(CTransaction(tx), *(stack.back()), undo, height); UpdateCoins(CTransaction{tx}, *(stack.back()), undo, height);
// Update the utxo set for future spends // Update the utxo set for future spends
utxoset.insert(outpoint); utxoset.insert(outpoint);

View File

@ -214,7 +214,7 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view)
return; return;
} }
bool expected_code_path = false; bool expected_code_path = false;
const int height = fuzzed_data_provider.ConsumeIntegral<int>(); const int height{int(fuzzed_data_provider.ConsumeIntegral<uint32_t>() >> 1)};
const bool possible_overwrite = fuzzed_data_provider.ConsumeBool(); const bool possible_overwrite = fuzzed_data_provider.ConsumeBool();
try { try {
AddCoins(coins_view_cache, transaction, height, possible_overwrite); AddCoins(coins_view_cache, transaction, height, possible_overwrite);

View File

@ -51,7 +51,6 @@ implicit-integer-sign-change:bech32.cpp
implicit-integer-sign-change:common/bloom.cpp implicit-integer-sign-change:common/bloom.cpp
implicit-integer-sign-change:chain.cpp implicit-integer-sign-change:chain.cpp
implicit-integer-sign-change:chain.h implicit-integer-sign-change:chain.h
implicit-integer-sign-change:coins.h
implicit-integer-sign-change:compat/stdin.cpp implicit-integer-sign-change:compat/stdin.cpp
implicit-integer-sign-change:compressor.h implicit-integer-sign-change:compressor.h
implicit-integer-sign-change:crc32c/ implicit-integer-sign-change:crc32c/