Skip to content

Commit 19d888c

Browse files
committed
rpc: move WALLET_FLAG_CAVEATS to the compilation unit of its caller
and add the walletutil.h include header for WALLET_FLAG_AVOID_REUSE that was already missing before this change. WALLET_FLAG_CAVEATS is only used in one RPC, so no need to encumber wallet.h and wallet.cpp with it, along with all of the files that include wallet.h during their compilation. Also apply clang-format per: git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v
1 parent 01df011 commit 19d888c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/wallet/rpc/wallet.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@
1313
#include <wallet/rpc/wallet.h>
1414
#include <wallet/rpc/util.h>
1515
#include <wallet/wallet.h>
16+
#include <wallet/walletutil.h>
1617

1718
#include <optional>
1819

1920
#include <univalue.h>
2021

2122

2223
namespace wallet {
24+
25+
static const std::map<uint64_t, std::string> WALLET_FLAG_CAVEATS{
26+
{WALLET_FLAG_AVOID_REUSE,
27+
"You need to rescan the blockchain in order to correctly mark used "
28+
"destinations in the past. Until this is done, some destinations may "
29+
"be considered unused, even if the opposite is the case."},
30+
};
31+
2332
/** Checks if a CKey is in the given CWallet compressed or otherwise*/
2433
bool HaveKey(const SigningProvider& wallet, const CKey& key)
2534
{

src/wallet/wallet.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@
5151
using interfaces::FoundBlock;
5252

5353
namespace wallet {
54-
const std::map<uint64_t,std::string> WALLET_FLAG_CAVEATS{
55-
{WALLET_FLAG_AVOID_REUSE,
56-
"You need to rescan the blockchain in order to correctly mark used "
57-
"destinations in the past. Until this is done, some destinations may "
58-
"be considered unused, even if the opposite is the case."
59-
},
60-
};
6154

6255
bool AddWalletSetting(interfaces::Chain& chain, const std::string& wallet_name)
6356
{

src/wallet/wallet.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ static const std::map<std::string,WalletFlags> WALLET_FLAG_MAP{
145145
{"external_signer", WALLET_FLAG_EXTERNAL_SIGNER}
146146
};
147147

148-
extern const std::map<uint64_t,std::string> WALLET_FLAG_CAVEATS;
149-
150148
/** A wrapper to reserve an address from a wallet
151149
*
152150
* ReserveDestination is used to reserve an address.

0 commit comments

Comments
 (0)