This commit is contained in:
Oghenovo Usiwoma 2025-04-28 20:49:08 +05:30 committed by GitHub
commit cb1e04c871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View file

@ -2852,6 +2852,11 @@ bool DescriptorScriptPubKeyMan::CanUpdateToWalletDescriptor(const WalletDescript
return false;
}
if (!descriptor.descriptor->IsRange()) {
// Skip range check for non-range descriptors
return true;
}
if (descriptor.range_start > m_wallet_descriptor.range_start ||
descriptor.range_end < m_wallet_descriptor.range_end) {
// Use inclusive range for error

View file

@ -73,6 +73,27 @@ static void AddKey(CWallet& wallet, const CKey& key)
assert(spk_manager);
}
BOOST_FIXTURE_TEST_CASE(update_non_range_descriptor, TestingSetup)
{
CWallet wallet(m_node.chain.get(), "", CreateMockableWalletDatabase());
{
LOCK(wallet.cs_wallet);
wallet.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
auto key{GenerateRandomKey()};
auto desc_str{"combo(" + EncodeSecret(key) + ")"};
for (size_t i = 0; i < 2; i++)
{
FlatSigningProvider provider;
std::string error;
auto descs{Parse(desc_str, provider, error, /* require_checksum=*/ false)};
auto& desc{descs.at(0)};
WalletDescriptor w_desc{std::move(desc), 0, 0, 0, 0};
auto spk_manager{*Assert(wallet.AddWalletDescriptor(w_desc, provider, "", false))};
assert(spk_manager);
}
}
}
BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
{
// Cap last block file size, and mine new block in a new block file.