Changeset View
Changeset View
Standalone View
Standalone View
src/test/descriptor_tests.cpp
Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < max; ++i) { | ||||
// When the descriptor is hardened, evaluate with access to the | // When the descriptor is hardened, evaluate with access to the | ||||
// private keys inside. | // private keys inside. | ||||
const FlatSigningProvider &key_provider = | const FlatSigningProvider &key_provider = | ||||
(flags & HARDENED) ? keys_priv : keys_pub; | (flags & HARDENED) ? keys_priv : keys_pub; | ||||
// Evaluate the descriptor selected by `t` in position `i`. | // Evaluate the descriptor selected by `t` in position `i`. | ||||
FlatSigningProvider script_provider, script_provider_cached; | FlatSigningProvider script_provider, script_provider_cached; | ||||
std::vector<CScript> spks, spks_cached; | std::vector<CScript> spks, spks_cached; | ||||
std::vector<uint8_t> cache; | DescriptorCache desc_cache; | ||||
BOOST_CHECK( | BOOST_CHECK((t ? parse_priv : parse_pub) | ||||
(t ? parse_priv : parse_pub) | ->Expand(i, key_provider, spks, script_provider, | ||||
->Expand(i, key_provider, spks, script_provider, &cache)); | &desc_cache)); | ||||
// Compare the output with the expected result. | // Compare the output with the expected result. | ||||
BOOST_CHECK_EQUAL(spks.size(), ref.size()); | BOOST_CHECK_EQUAL(spks.size(), ref.size()); | ||||
// Try to expand again using cached data, and compare. | // Try to expand again using cached data, and compare. | ||||
BOOST_CHECK(parse_pub->ExpandFromCache(i, cache, spks_cached, | BOOST_CHECK(parse_pub->ExpandFromCache(i, desc_cache, spks_cached, | ||||
script_provider_cached)); | script_provider_cached)); | ||||
BOOST_CHECK(spks == spks_cached); | BOOST_CHECK(spks == spks_cached); | ||||
BOOST_CHECK(script_provider.pubkeys == | BOOST_CHECK(script_provider.pubkeys == | ||||
script_provider_cached.pubkeys); | script_provider_cached.pubkeys); | ||||
BOOST_CHECK(script_provider.scripts == | BOOST_CHECK(script_provider.scripts == | ||||
script_provider_cached.scripts); | script_provider_cached.scripts); | ||||
BOOST_CHECK(script_provider.origins == | BOOST_CHECK(script_provider.origins == | ||||
script_provider_cached.origins); | script_provider_cached.origins); | ||||
▲ Show 20 Lines • Show All 638 Lines • Show Last 20 Lines |