Skip to content

Commit 50cfc9e

Browse files
committed
(pubk)key: mark Derive() as nodiscard
1 parent 0ca258a commit 50cfc9e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/key.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class CKey
146146
bool SignSchnorr(const uint256& hash, Span<unsigned char> sig, const uint256* merkle_root, const uint256& aux) const;
147147

148148
//! Derive BIP32 child key.
149-
bool Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
149+
[[nodiscard]] bool Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
150150

151151
/**
152152
* Verify thoroughly whether a private key and a public key match.
@@ -176,7 +176,7 @@ struct CExtKey {
176176

177177
void Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const;
178178
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]);
179-
bool Derive(CExtKey& out, unsigned int nChild) const;
179+
[[nodiscard]] bool Derive(CExtKey& out, unsigned int nChild) const;
180180
CExtPubKey Neuter() const;
181181
void SetSeed(Span<const std::byte> seed);
182182
};

src/pubkey.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class CPubKey
218218
bool Decompress();
219219

220220
//! Derive BIP32 child pubkey.
221-
bool Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
221+
[[nodiscard]] bool Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
222222
};
223223

224224
class XOnlyPubKey
@@ -327,7 +327,7 @@ struct CExtPubKey {
327327
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]);
328328
void EncodeWithVersion(unsigned char code[BIP32_EXTKEY_WITH_VERSION_SIZE]) const;
329329
void DecodeWithVersion(const unsigned char code[BIP32_EXTKEY_WITH_VERSION_SIZE]);
330-
bool Derive(CExtPubKey& out, unsigned int nChild) const;
330+
[[nodiscard]] bool Derive(CExtPubKey& out, unsigned int nChild) const;
331331
};
332332

333333
/** Users of this module must hold an ECCVerifyHandle. The constructor and

0 commit comments

Comments
 (0)