File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -1561,12 +1561,18 @@ bool DescriptorScriptPubKeyMan::IsHDEnabled() const
1561
1561
1562
1562
bool DescriptorScriptPubKeyMan::CanGetAddresses (bool internal) const
1563
1563
{
1564
- return false ;
1564
+ // We can only give out addresses from descriptors that are single type (not combo), ranged,
1565
+ // and either have cached keys or can generate more keys (ignoring encryption)
1566
+ LOCK (cs_desc_man);
1567
+ return m_wallet_descriptor.descriptor ->IsSingleType () &&
1568
+ m_wallet_descriptor.descriptor ->IsRange () &&
1569
+ (HavePrivateKeys () || m_wallet_descriptor.next_index < m_wallet_descriptor.range_end );
1565
1570
}
1566
1571
1567
1572
bool DescriptorScriptPubKeyMan::HavePrivateKeys () const
1568
1573
{
1569
- return false ;
1574
+ LOCK (cs_desc_man);
1575
+ return m_map_keys.size () > 0 || m_map_crypted_keys.size () > 0 ;
1570
1576
}
1571
1577
1572
1578
int64_t DescriptorScriptPubKeyMan::GetOldestKeyPoolTime () const
@@ -1576,17 +1582,22 @@ int64_t DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() const
1576
1582
1577
1583
size_t DescriptorScriptPubKeyMan::KeypoolCountExternalKeys () const
1578
1584
{
1579
- return 0 ;
1585
+ if (m_internal) {
1586
+ return 0 ;
1587
+ }
1588
+ return GetKeyPoolSize ();
1580
1589
}
1581
1590
1582
1591
unsigned int DescriptorScriptPubKeyMan::GetKeyPoolSize () const
1583
1592
{
1584
- return 0 ;
1593
+ LOCK (cs_desc_man);
1594
+ return m_wallet_descriptor.range_end - m_wallet_descriptor.next_index ;
1585
1595
}
1586
1596
1587
1597
int64_t DescriptorScriptPubKeyMan::GetTimeFirstKey () const
1588
1598
{
1589
- return 0 ;
1599
+ LOCK (cs_desc_man);
1600
+ return m_wallet_descriptor.creation_time ;
1590
1601
}
1591
1602
1592
1603
std::unique_ptr<SigningProvider> DescriptorScriptPubKeyMan::GetSolvingProvider (const CScript& script) const
You can’t perform that action at this time.
0 commit comments