Split chainparams.cpp and rpcwallet.cpp into smaller files
chainparams.cpp: 5420 -> 593 lines - Extract HUSH3 checkpoint data to chainparams_checkpoints_hush3.h - Extract DRAGONX checkpoint data to chainparams_checkpoints_dragonx.h rpcwallet.cpp: 6392 -> 4099 lines - Extract z-index query RPCs to rpcwallet_zindex.cpp - Extract shielded async operation RPCs to rpcwallet_zops.cpp - Create rpcwallet_internal.h for shared declarations
This commit is contained in:
@@ -36,8 +36,15 @@ Several files are extremely large and would benefit from decomposition:
|
||||
| `src/wallet/wallet.cpp` | 5,059 | Split wallet transaction logic from key management |
|
||||
|
||||
- [ ] Split `src/main.cpp`
|
||||
- [ ] Split `src/wallet/rpcwallet.cpp`
|
||||
- [ ] Split `src/chainparams.cpp`
|
||||
- [x] Split `src/wallet/rpcwallet.cpp`
|
||||
- 6,392 → 4,099 lines in `rpcwallet.cpp`
|
||||
- Created `wallet/rpcwallet_zindex.cpp` (1,193 lines) — z-index query RPCs (`getalldata`, `z_getinfo`, `z_getstats`, etc.)
|
||||
- Created `wallet/rpcwallet_zops.cpp` (1,194 lines) — shielded async operation RPCs (`z_sendmany`, `z_shieldcoinbase`, `z_mergetoaddress`, etc.)
|
||||
- Created `wallet/rpcwallet_internal.h` (45 lines) — shared declarations and `THROW_IF_SYNCING` macro
|
||||
- [x] Split `src/chainparams.cpp`
|
||||
- 5,420 → 593 lines in `chainparams.cpp`
|
||||
- Created `chainparams_checkpoints_hush3.h` (1,986 lines) — HUSH3 checkpoint data
|
||||
- Created `chainparams_checkpoints_dragonx.h` (2,853 lines) — DRAGONX checkpoint data
|
||||
- [ ] Split `src/wallet/wallet.cpp`
|
||||
|
||||
## 5. Move Implementation Out of Header Files
|
||||
@@ -120,4 +127,4 @@ Docs are split across `doc/`, `contrib/README.md`, and the root.
|
||||
4. Item **5** — move implementation out of headers
|
||||
5. Item **4** — split monolithic source files
|
||||
6. Item **6** — deduplicate cJSON
|
||||
7. Item **2** — move params to LFS or download script
|
||||
7. Item **2** — Move shell scripts to `contrib/scripts/` directory
|
||||
|
||||
@@ -240,6 +240,7 @@ BITCOIN_CORE_H = \
|
||||
wallet/crypter.h \
|
||||
wallet/db.h \
|
||||
wallet/rpcwallet.h \
|
||||
wallet/rpcwallet_internal.h \
|
||||
wallet/rpchushwallet.h \
|
||||
wallet/wallet.h \
|
||||
wallet/wallet_ismine.h \
|
||||
@@ -324,6 +325,8 @@ libbitcoin_wallet_a_SOURCES = \
|
||||
wallet/rpcdump.cpp \
|
||||
cc/CCtx.cpp \
|
||||
wallet/rpcwallet.cpp \
|
||||
wallet/rpcwallet_zindex.cpp \
|
||||
wallet/rpcwallet_zops.cpp \
|
||||
wallet/rpchushwallet.cpp \
|
||||
wallet/wallet.cpp \
|
||||
wallet/wallet_ismine.cpp \
|
||||
|
||||
4831
src/chainparams.cpp
4831
src/chainparams.cpp
File diff suppressed because it is too large
Load Diff
2853
src/chainparams_checkpoints_dragonx.h
Normal file
2853
src/chainparams_checkpoints_dragonx.h
Normal file
File diff suppressed because it is too large
Load Diff
1986
src/chainparams_checkpoints_hush3.h
Normal file
1986
src/chainparams_checkpoints_hush3.h
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
45
src/wallet/rpcwallet_internal.h
Normal file
45
src/wallet/rpcwallet_internal.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2016-2024 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
//
|
||||
// Shared declarations for rpcwallet_*.cpp split files.
|
||||
// These helper functions are defined in rpcwallet.cpp but called from other rpcwallet_*.cpp files.
|
||||
|
||||
#ifndef HUSH_WALLET_RPCWALLET_INTERNAL_H
|
||||
#define HUSH_WALLET_RPCWALLET_INTERNAL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class UniValue;
|
||||
class CPubKey;
|
||||
|
||||
// Macro used by multiple rpcwallet files — call-site must include main.h and hush_globals.h
|
||||
#define THROW_IF_SYNCING(INSYNC) if (HUSH_TESTNODE == 0 && INSYNC == 0) { throw runtime_error(strprintf("%s: Extreme Privacy! Chain still syncing at height %d, aborting to prevent linkability analysis. Please wait until FULLY SYNCED and try again.",__FUNCTION__,chainActive.Tip()->GetHeight())); }
|
||||
|
||||
// Helper functions defined in rpcwallet.cpp
|
||||
bool EnsureWalletIsAvailable(bool avoidException);
|
||||
void EnsureWalletIsUnlocked();
|
||||
std::string HelpRequiringPassphrase();
|
||||
|
||||
// Functions defined in rpcwallet_zops.cpp
|
||||
UniValue z_getoperationstatus_IMPL(const UniValue&, bool);
|
||||
UniValue z_getoperationresult(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_getoperationstatus(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_shieldcoinbase(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_mergetoaddress(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_listoperationids(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
|
||||
// Functions defined in rpcwallet_zindex.cpp
|
||||
UniValue getalldata(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_consolidationstatus(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_sweepstatus(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_listreceivedaddress(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_listsentbyaddress(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_anonsetblockdelta(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_anonsettxdelta(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
UniValue z_getbalances(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
|
||||
#endif // HUSH_WALLET_RPCWALLET_INTERNAL_H
|
||||
1193
src/wallet/rpcwallet_zindex.cpp
Normal file
1193
src/wallet/rpcwallet_zindex.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1194
src/wallet/rpcwallet_zops.cpp
Normal file
1194
src/wallet/rpcwallet_zops.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user