Skip to content

Commit ca6a62d

Browse files
committed
[MOVE-ONLY] Move wallet RPC declarations to rpcwallet.h
based on bitcoin/bitcoin@a435632
1 parent 687c2fd commit ca6a62d

File tree

10 files changed

+41
-26
lines changed

10 files changed

+41
-26
lines changed

src/rest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "utilstrencodings.h"
1717
#include "validation.h"
1818
#include "version.h"
19+
#include "wallet/wallet.h"
1920

2021
#include <boost/algorithm/string.hpp>
2122

src/rpc/budget.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#include "messagesigner.h"
1616
#include "rpc/server.h"
1717
#include "utilmoneystr.h"
18+
#ifdef ENABLE_WALLET
19+
#include "wallet/rpcwallet.h"
20+
#endif
1821

1922
#include <univalue.h>
2023

src/rpc/masternode.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include "netbase.h"
1515
#include "rpc/server.h"
1616
#include "utilmoneystr.h"
17+
#ifdef ENABLE_WALLET
18+
#include "wallet/rpcwallet.h"
19+
#endif
1720

1821
#include <univalue.h>
1922

src/rpc/mining.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "rpc/server.h"
1818
#include "validationinterface.h"
1919
#ifdef ENABLE_WALLET
20+
#include "wallet/rpcwallet.h"
2021
#include "wallet/db.h"
2122
#include "wallet/wallet.h"
2223
#endif

src/rpc/misc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "timedata.h"
1919
#include "util/system.h"
2020
#ifdef ENABLE_WALLET
21+
#include "wallet/rpcwallet.h"
2122
#include "wallet/wallet.h"
2223
#include "wallet/walletdb.h"
2324
#endif

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#ifdef ENABLE_WALLET
2626
#include "sapling/address.h"
2727
#include "sapling/key_io_sapling.h"
28+
#include "wallet/rpcwallet.h"
2829
#include "wallet/wallet.h"
2930
#endif
3031

src/rpc/server.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,6 @@ extern double GetDifficulty(const CBlockIndex* blockindex = NULL);
196196
extern std::string HelpExampleCli(std::string methodname, std::string args);
197197
extern std::string HelpExampleRpc(std::string methodname, std::string args);
198198

199-
// Needed even with !ENABLE_WALLET, to pass (ignored) pointers around
200-
class CWallet;
201-
CWallet* GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
202-
203-
#ifdef ENABLE_WALLET
204-
// New code should accessing the wallet should be under the ../wallet/ directory
205-
std::string HelpRequiringPassphrase(CWallet* const pwallet);
206-
bool EnsureWalletIsAvailable(CWallet* const pwallet, bool avoidException);
207-
void EnsureWalletIsUnlocked(CWallet *pwallet, bool fAllowAnonOnly = false);
208-
#endif
209-
210199
bool StartRPC();
211200
void InterruptRPC();
212201
void StopRPC();

src/wallet/rpcdump.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
#include "util/system.h"
1616
#include "utilstrencodings.h"
1717
#include "utiltime.h"
18-
#include "wallet/wallet.h"
18+
#include "wallet/rpcwallet.h"
19+
#include "wallet.h"
20+
#include "validation.h"
1921

2022
#include <fstream>
2123
#include <secp256k1.h>

src/wallet/rpcwallet.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// Distributed under the MIT software license, see the accompanying
66
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
77

8+
#include "wallet/rpcwallet.h"
9+
810
#include "addressbook.h"
911
#include "amount.h"
1012
#include "base58.h"
@@ -17,21 +19,17 @@
1719
#include "net.h"
1820
#include "policy/feerate.h"
1921
#include "rpc/server.h"
20-
#include "timedata.h"
21-
#include "util/system.h"
22-
#include "utilmoneystr.h"
23-
#include "wallet.h"
24-
#include "walletdb.h"
25-
#include "zpivchain.h"
26-
2722
#include "sapling/sapling_operation.h"
2823
#include "sapling/transaction_builder.h"
2924
#include "sapling/key_io_sapling.h"
30-
31-
#include <stdint.h>
32-
3325
#include "spork.h"
26+
#include "timedata.h"
27+
#include "utilmoneystr.h"
28+
#include "wallet/wallet.h"
29+
#include "wallet/walletdb.h"
30+
#include "zpivchain.h"
3431

32+
#include <stdint.h>
3533
#include <univalue.h>
3634

3735

src/wallet/rpcwallet.h

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1-
// Copyright (c) 2016 The Bitcoin Core developers
1+
// Copyright (c) 2016-2021 The Bitcoin Core developers
2+
// Copyright (c) 2021 The PIVX developers
23
// Distributed under the MIT software license, see the accompanying
34
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
#ifndef PIVX_WALLET_RPCWALLET_H
6+
#define PIVX_WALLET_RPCWALLET_H
47

5-
#ifndef BITCOIN_WALLET_RPCWALLET_H
6-
#define BITCOIN_WALLET_RPCWALLET_H
8+
#include <string>
79

810
class CRPCTable;
11+
class CWallet;
12+
class JSONRPCRequest;
913

1014
void RegisterWalletRPCCommands(CRPCTable &tableRPC);
1115

12-
#endif //BITCOIN_WALLET_RPCWALLET_H
16+
/**
17+
* Figures out what wallet, if any, to use for a JSONRPCRequest.
18+
*
19+
* @param[in] request JSONRPCRequest that wishes to access a wallet
20+
* @return NULL if no wallet should be used, or a pointer to the CWallet
21+
*/
22+
CWallet* GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
23+
24+
std::string HelpRequiringPassphrase(CWallet* const pwallet);
25+
bool EnsureWalletIsAvailable(CWallet* const pwallet, bool avoidException);
26+
void EnsureWalletIsUnlocked(CWallet* const pwallet, bool fAllowAnonOnly = false);
27+
28+
#endif //PIVX_WALLET_RPCWALLET_H

0 commit comments

Comments
 (0)