Skip to content

Commit ec79b5f

Browse files
committed
Merge bitcoin#18782: wallet: Make sure no DescriptorScriptPubKeyMan or WalletDescriptor members are left uninitialized after construction
2a78098 wallet: Make sure no WalletDescriptor members are uninitialized after construction (practicalswift) ff046ae wallet: Make sure no DescriptorScriptPubKeyMan members are uninitialized after construction (practicalswift) Pull request description: This is a small folllow-up to bitcoin#16528 ("Native Descriptor Wallets using DescriptorScriptPubKeyMan") which was merged in to `master` a couple of hours ago. Make sure no `DescriptorScriptPubKeyMan` or `WalletDescriptor` members are left uninitialized after construction. Before this change `bool m_internal` was left uninitialized when using the `DescriptorScriptPubKeyMan(WalletStorage&, WalletDescriptor&)` ctor. The same goes for the now initialized integers which were left uninitialized when using the `WalletDescriptor()` ctor. ACKs for top commit: instagibbs: utACK bitcoin@2a78098 fjahr: Code review ACK 2a78098 Sjors: utACK 2a78098 achow101: ACK 2a78098 brakmic: Code review ACK 2a78098 meshcollider: utACK 2a78098 Tree-SHA512: c98e035268fdc7f65a423b73ac0cf010b0ef7c5e679b3cf170c1813efac8ab5c657dcbaf43c746770bea59e4772bfefe4caa834f1175260c39c7f35d92946ba5
2 parents e727c2b + 2a78098 commit ec79b5f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/wallet/scriptpubkeyman.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
498498
int32_t m_max_cached_index = -1;
499499

500500
OutputType m_address_type;
501-
bool m_internal;
501+
bool m_internal = false;
502502

503503
KeyMap m_map_keys GUARDED_BY(cs_desc_man);
504504
CryptedKeyMap m_map_crypted_keys GUARDED_BY(cs_desc_man);

src/wallet/walletutil.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ class WalletDescriptor
9292
{
9393
public:
9494
std::shared_ptr<Descriptor> descriptor;
95-
uint64_t creation_time;
96-
int32_t range_start; // First item in range; start of range, inclusive, i.e. [range_start, range_end). This never changes.
97-
int32_t range_end; // Item after the last; end of range, exclusive, i.e. [range_start, range_end). This will increment with each TopUp()
98-
int32_t next_index; // Position of the next item to generate
95+
uint64_t creation_time = 0;
96+
int32_t range_start = 0; // First item in range; start of range, inclusive, i.e. [range_start, range_end). This never changes.
97+
int32_t range_end = 0; // Item after the last; end of range, exclusive, i.e. [range_start, range_end). This will increment with each TopUp()
98+
int32_t next_index = 0; // Position of the next item to generate
9999
DescriptorCache cache;
100100

101101
ADD_SERIALIZE_METHODS;

0 commit comments

Comments
 (0)