wallet: (trivial) mark calc_unused_change_addresses as private
What changed, and why it matters
This commit simply renames a wallet method by adding an underscore prefix, which is a Python convention for 'this is intended for internal use only.' No behavior, logic, or security properties of the code change. It is a cosmetic/private-API marking.
No action needed; this is a non-security refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff renames calc_unused_change_addresses to _calc_unused_change_addresses in Abstract_Wallet, Imported_Wallet, and all call sites. The method’s implementation, return type, and callers remain identical. There is no functional or security change.
Changed components
electrum/wallet.pyInspect captured patch +4 / −4
diff --git a/electrum/wallet.py b/electrum/wallet.py
index 9bd1e9c..640aedf 100644
--- a/electrum/wallet.py
+++ b/electrum/wallet.py
@@ -444,7 +444,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
self._init_lnworker()
self._init_requests_rhash_index()
self._prepare_onchain_invoice_paid_detection()
- self.calc_unused_change_addresses()
+ self._calc_unused_change_addresses()
# save wallet type the first time
if self.db.get('wallet_type') is None:
self.db.put('wallet_type', self.wallet_type)
@@ -707,7 +707,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
return addr
return wrapper
- def calc_unused_change_addresses(self) -> Sequence[str]:
+ def _calc_unused_change_addresses(self) -> Sequence[str]:
"""Returns a list of change addresses to choose from, for usage in e.g. new transactions.
The caller should give priority to earlier ones in the list.
"""
@@ -1891,7 +1891,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
allow_reuse: bool = True,
) -> Sequence[str]:
# Recalc and get unused change addresses
- addrs = self.calc_unused_change_addresses()
+ addrs = self._calc_unused_change_addresses()
# New change addresses are created only after a few
# confirmations.
if addrs:
@@ -3754,7 +3754,7 @@ class Imported_Wallet(Simple_Wallet):
**{**kwargs, "allow_reusing_used_change_addrs": False},
)
- def calc_unused_change_addresses(self) -> Sequence[str]:
+ def _calc_unused_change_addresses(self) -> Sequence[str]:
with self.lock:
unused_addrs = [addr for addr in self.get_change_addresses()
if not self.adb.is_used(addr) and not self.is_address_reserved(addr)]
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.