Merge 92fee79dab into merged_master (Bitcoin PR #19806)

Looks like James hardcoded a couple hashes in hard-to-find places, which
caused a unit test to fail. I just changed the hash (which covers UTXO
data which naturally will be different for us on account of our differently
formatted CTxOuts).

TODO: determine how Assumeutxo interacts with the fact that we don't save
out nonces in our normal UTXO serialization. Probably we will need to remove
the nonce from the CCoinStats serialization to avoid having inconsistent
hashes across nodes, since these hashes are now checked in assumeutxo?
This commit is contained in:
Andrew Poelstra 2021-06-23 23:36:26 +00:00
commit 61a241c5ca
17 changed files with 715 additions and 30 deletions

View file

@ -5,6 +5,7 @@
#include <chainparams.h>
#include <net.h>
#include <signet.h>
#include <uint256.h>
#include <validation.h>
#include <test/util/setup_common.h>
@ -120,4 +121,27 @@ BOOST_AUTO_TEST_CASE(signet_parse_tests)
BOOST_CHECK(!CheckSignetBlockSolution(block, signet_params->GetConsensus()));
}
//! Test retrieval of valid assumeutxo values.
BOOST_AUTO_TEST_CASE(test_assumeutxo)
{
const auto params = CreateChainParams(*m_node.args, CBaseChainParams::REGTEST);
// These heights don't have assumeutxo configurations associated, per the contents
// of chainparams.cpp.
std::vector<int> bad_heights{0, 100, 111, 115, 209, 211};
for (auto empty : bad_heights) {
const auto out = ExpectedAssumeutxo(empty, *params);
BOOST_CHECK(!out);
}
const auto out110 = *ExpectedAssumeutxo(110, *params);
BOOST_CHECK_EQUAL(out110.hash_serialized, uint256S("4fa9f2be16670cb097173e6b788974fb9106c2335c074267ca5f7fc297dded32"));
BOOST_CHECK_EQUAL(out110.nChainTx, (unsigned int)110);
const auto out210 = *ExpectedAssumeutxo(210, *params);
BOOST_CHECK_EQUAL(out210.hash_serialized, uint256S("9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2"));
BOOST_CHECK_EQUAL(out210.nChainTx, (unsigned int)210);
}
BOOST_AUTO_TEST_SUITE_END()