mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge fa0993462b
into 51d76634fb
This commit is contained in:
commit
4da8394c73
2 changed files with 26 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue