diff --git a/doc/build-unix.md b/doc/build-unix.md index 946b4fd0eebd..0a6300557736 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -272,20 +272,16 @@ A list of additional configure flags can be displayed with: Setup and Build Example: Arch Linux ----------------------------------- -This example lists the steps necessary to setup and build a command line only, non-wallet distribution of the latest changes on Arch Linux: +This example lists the steps necessary to setup and build a command line only distribution of the latest changes on Arch Linux: ```sh -pacman -S git base-devel boost libevent python +pacman --sync --needed autoconf automake boost gcc git libevent libtool make pkgconf python sqlite git clone https://github.com/dashpay/dash.git cd dash/ ./autogen.sh -./configure --disable-wallet --without-gui --without-miniupnpc +./configure make check +./src/dashd ``` -Note: -Enabling wallet support requires either compiling against a Berkeley DB newer than 4.8 (package `db`) using `--with-incompatible-bdb`, -or building and depending on a local version of Berkeley DB 4.8. The readily available Arch Linux packages are currently built using -`--with-incompatible-bdb` according to the [PKGBUILD](https://github.com/archlinux/svntogit-community/blob/packages/bitcoin/trunk/PKGBUILD). -As mentioned above, when maintaining portability of the wallet between the standard Dash Core distributions and independently built -node software is desired, Berkeley DB 4.8 must be used. +If you intend to work with legacy Berkeley DB wallets, see [Berkeley DB](#berkeley-db) section. diff --git a/doc/release-notes/release-notes-24408.md b/doc/release-notes/release-notes-24408.md new file mode 100644 index 000000000000..1072ec786a53 --- /dev/null +++ b/doc/release-notes/release-notes-24408.md @@ -0,0 +1,5 @@ +New RPCs +-------- + +- A new `gettxspendingprevout` RPC has been added, which scans the mempool to find + transactions spending any of the given outpoints. (#24408) \ No newline at end of file diff --git a/src/.clang-tidy b/src/.clang-tidy index 3d8b242963ff..5ac571061309 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -1,6 +1,7 @@ Checks: ' -*, bugprone-argument-comment, +modernize-use-default-member-init, modernize-use-nullptr, readability-const-return-type, readability-redundant-declaration, @@ -8,6 +9,7 @@ readability-redundant-string-init, ' WarningsAsErrors: ' bugprone-argument-comment, +modernize-use-default-member-init, modernize-use-nullptr, readability-redundant-declaration, readability-redundant-string-init, diff --git a/src/base58.h b/src/base58.h index 9ba5af73e059..d2a8d5e3bc47 100644 --- a/src/base58.h +++ b/src/base58.h @@ -14,7 +14,6 @@ #ifndef BITCOIN_BASE58_H #define BITCOIN_BASE58_H -#include #include #include diff --git a/src/bench/checkqueue.cpp b/src/bench/checkqueue.cpp index 85b3ce61bcc7..d861faac243f 100644 --- a/src/bench/checkqueue.cpp +++ b/src/bench/checkqueue.cpp @@ -29,8 +29,7 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench) struct PrevectorJob { prevector p; - PrevectorJob(){ - } + PrevectorJob() = default; explicit PrevectorJob(FastRandomContext& insecure_rand){ p.resize(insecure_rand.randrange(PREVECTOR_SIZE*2)); } diff --git a/src/bench/prevector.cpp b/src/bench/prevector.cpp index 3b2682001fd8..9ff4629741b3 100644 --- a/src/bench/prevector.cpp +++ b/src/bench/prevector.cpp @@ -11,8 +11,8 @@ #include struct nontrivial_t { - int x; - nontrivial_t() :x(-1) {} + int x{-1}; + nontrivial_t() = default; SERIALIZE_METHODS(nontrivial_t, obj) { READWRITE(obj.x); } }; typedef prevector<28, unsigned char> prevec; diff --git a/src/bench/wallet_loading.cpp b/src/bench/wallet_loading.cpp index b01732b615a1..3d8700d5592b 100644 --- a/src/bench/wallet_loading.cpp +++ b/src/bench/wallet_loading.cpp @@ -26,7 +26,7 @@ using wallet::WALLET_FLAG_DESCRIPTORS; using wallet::WalletContext; using wallet::WalletDatabase; -static const std::shared_ptr BenchLoadWallet(std::unique_ptr database, WalletContext& context, DatabaseOptions& options) +static std::shared_ptr BenchLoadWallet(std::unique_ptr database, WalletContext& context, DatabaseOptions& options) { bilingual_str error; std::vector warnings; diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 29f262e0c25b..3e94ea5a2689 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -199,10 +199,10 @@ static int AppInitRPC(int argc, char* argv[]) /** Reply structure for request_done to fill in */ struct HTTPReply { - HTTPReply(): status(0), error(-1) {} + HTTPReply() = default; - int status; - int error; + int status{0}; + int error{-1}; std::string body; }; @@ -263,7 +263,7 @@ static void http_error_cb(enum evhttp_request_error err, void *ctx) class BaseRequestHandler { public: - virtual ~BaseRequestHandler() {} + virtual ~BaseRequestHandler() = default; virtual UniValue PrepareRequest(const std::string& method, const std::vector& args) = 0; virtual UniValue ProcessReply(const UniValue &batch_in) = 0; }; diff --git a/src/core_io.h b/src/core_io.h index d3f424d1363f..8dd365f95518 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -5,7 +5,6 @@ #ifndef BITCOIN_CORE_IO_H #define BITCOIN_CORE_IO_H -#include #include #include diff --git a/src/evo/netinfo.h b/src/evo/netinfo.h index 3ea51992b79e..0f33649de0fd 100644 --- a/src/evo/netinfo.h +++ b/src/evo/netinfo.h @@ -195,20 +195,20 @@ class NetInfoEntry public: NetInfoEntry() = default; - NetInfoEntry(const DomainPort& domain) + explicit NetInfoEntry(const DomainPort& domain) { if (!domain.IsValid()) return; m_type = NetInfoType::Domain; m_data = domain; } - NetInfoEntry(const CService& service) + explicit NetInfoEntry(const CService& service) { if (!service.IsValid()) return; m_type = NetInfoType::Service; m_data = service; } template - NetInfoEntry(deserialize_type, Stream& s) { s >> *this; } + explicit NetInfoEntry(deserialize_type, Stream& s) { s >> *this; } ~NetInfoEntry() = default; @@ -220,12 +220,12 @@ class NetInfoEntry void Serialize(Stream& s_) const { OverrideStream s(&s_, /*nType=*/0, s_.GetVersion() | ADDRV2_FORMAT); - if (const auto* data_ptr{std::get_if(&m_data)}; - m_type == NetInfoType::Service && data_ptr && data_ptr->IsValid()) { - s << m_type << *data_ptr; - } else if (const auto* data_ptr{std::get_if(&m_data)}; - m_type == NetInfoType::Domain && data_ptr && data_ptr->IsValid()) { - s << m_type << *data_ptr; + if (const auto* data_ptr_service{std::get_if(&m_data)}; + m_type == NetInfoType::Service && data_ptr_service && data_ptr_service->IsValid()) { + s << m_type << *data_ptr_service; + } else if (const auto* data_ptr_domain{std::get_if(&m_data)}; + m_type == NetInfoType::Domain && data_ptr_domain && data_ptr_domain->IsValid()) { + s << m_type << *data_ptr_domain; } else { s << NetInfoType::Invalid; } diff --git a/src/httpserver.cpp b/src/httpserver.cpp index fe8c8879ea43..60c5b9e89035 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -72,20 +72,18 @@ class WorkQueue std::condition_variable cond GUARDED_BY(cs); std::deque> queue GUARDED_BY(cs); std::deque> external_queue GUARDED_BY(cs); - bool running GUARDED_BY(cs); + bool running GUARDED_BY(cs){true}; const size_t maxDepth; const size_t m_external_depth; public: - explicit WorkQueue(size_t _maxDepth, size_t external_depth) : running(true), + explicit WorkQueue(size_t _maxDepth, size_t external_depth) : maxDepth(_maxDepth), m_external_depth(external_depth) { } /** Precondition: worker threads have all stopped (they have been joined). */ - ~WorkQueue() - { - } + ~WorkQueue() = default; /** Enqueue a work item */ bool Enqueue(WorkItem* item, bool is_external) EXCLUSIVE_LOCKS_REQUIRED(!cs) { diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 75e8bea7033f..5c2c78454331 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -52,7 +52,7 @@ TxIndex::TxIndex(size_t n_cache_size, bool f_memory, bool f_wipe) : m_db(std::make_unique(n_cache_size, f_memory, f_wipe)) {} -TxIndex::~TxIndex() {} +TxIndex::~TxIndex() = default; bool TxIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex) { diff --git a/src/init.cpp b/src/init.cpp index 25b2ca72090c..805d208e2c55 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -121,7 +121,6 @@ #include #ifndef WIN32 -#include #include #include #include diff --git a/src/logging.cpp b/src/logging.cpp index 1655206166fa..1b8dc8a91ae4 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -462,8 +462,9 @@ void BCLog::Logger::LogPrintStr(const std::string& str, const std::string& loggi } if (m_log_threadnames && m_started_new_line) { + const auto threadname = util::ThreadGetInternalName(); // 16 chars total, "dash-" is 5 of them and another 1 is a NUL terminator - str_prefixed.insert(0, "[" + strprintf("%10s", util::ThreadGetInternalName()) + "] "); + str_prefixed.insert(0, "[" + strprintf("%10s", (threadname.empty() ? "unknown" : threadname)) + "] "); } str_prefixed = LogTimestampStr(str_prefixed); diff --git a/src/net.cpp b/src/net.cpp index b339dd451460..d5f5b2f5e2d5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -4064,7 +4064,7 @@ bool CConnman::Start(CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_met class CNetCleanup { public: - CNetCleanup() {} + CNetCleanup() = default; ~CNetCleanup() { diff --git a/src/netaddress.cpp b/src/netaddress.cpp index cea9e194e9d4..76fe1f2e8e82 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -99,7 +99,7 @@ bool fAllowPrivateNet = DEFAULT_ALLOWPRIVATENET; * * @note This address is considered invalid by CNetAddr::IsValid() */ -CNetAddr::CNetAddr() {} +CNetAddr::CNetAddr() = default; void CNetAddr::SetIP(const CNetAddr& ipIn) { diff --git a/src/netaddress.h b/src/netaddress.h index 053b3369fc61..eb5a822a38a3 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -9,7 +9,6 @@ #include #endif -#include #include #include #include diff --git a/src/node/context.cpp b/src/node/context.cpp index 22296e423a92..e8407d8548f6 100644 --- a/src/node/context.cpp +++ b/src/node/context.cpp @@ -31,6 +31,6 @@ #include namespace node { -NodeContext::NodeContext() {} -NodeContext::~NodeContext() {} +NodeContext::NodeContext() = default; +NodeContext::~NodeContext() = default; } // namespace node diff --git a/src/node/transaction.h b/src/node/transaction.h index 3156e841e594..9617c1f99b92 100644 --- a/src/node/transaction.h +++ b/src/node/transaction.h @@ -5,7 +5,6 @@ #ifndef BITCOIN_NODE_TRANSACTION_H #define BITCOIN_NODE_TRANSACTION_H -#include #include #include #include diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 489c9944519e..c5f97a13191f 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -568,9 +568,7 @@ CBlockPolicyEstimator::CBlockPolicyEstimator() } } -CBlockPolicyEstimator::~CBlockPolicyEstimator() -{ -} +CBlockPolicyEstimator::~CBlockPolicyEstimator() = default; void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, bool validFeeEstimate) { diff --git a/src/psbt.h b/src/psbt.h index d3d778d8952a..7069a58e61f0 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -5,7 +5,6 @@ #ifndef BITCOIN_PSBT_H #define BITCOIN_PSBT_H -#include #include #include #include diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index d40a3deef6eb..f9eaf6d904b2 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -30,7 +30,7 @@ struct AddressTableEntry QString label; QString address; - AddressTableEntry() {} + AddressTableEntry() = default; AddressTableEntry(Type _type, const QString &_label, const QString &_address): type(_type), label(_label), address(_address) {} }; diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp index ba0e7b8480b2..107b7e797579 100644 --- a/src/qt/bantablemodel.cpp +++ b/src/qt/bantablemodel.cpp @@ -89,10 +89,7 @@ BanTableModel::BanTableModel(interfaces::Node& node, QObject* parent) : refresh(); } -BanTableModel::~BanTableModel() -{ - // Intentionally left empty -} +BanTableModel::~BanTableModel() = default; int BanTableModel::rowCount(const QModelIndex &parent) const { diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 37ac0c91d4ae..d71e08fd2ee8 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -38,12 +38,12 @@ static CAmount parse(const QString &text, BitcoinUnit nUnit, bool *valid_out= nu class AmountValidator : public QValidator { Q_OBJECT - BitcoinUnit currentUnit; + BitcoinUnit currentUnit{BitcoinUnit::DASH}; public: explicit AmountValidator(QObject *parent) : - QValidator(parent), - currentUnit(BitcoinUnit::DASH) {} + QValidator(parent) + {} State validate(QString &input, int &pos) const override { @@ -70,8 +70,7 @@ class AmountLineEdit: public QLineEdit AmountValidator* amountValidator; public: explicit AmountLineEdit(QWidget *parent): - QLineEdit(parent), - currentUnit(BitcoinUnit::DASH) + QLineEdit(parent) { setAlignment(Qt::AlignLeft); amountValidator = new AmountValidator(this); diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 728d861fb5ba..0fbbfcca41e6 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -886,7 +886,7 @@ bool isStyleSheetDirectoryCustom() return stylesheetDirectory != defaultStylesheetDirectory; } -const std::vector listStyleSheets() +std::vector listStyleSheets() { std::vector vecStylesheets; for (const auto& it : mapThemeToStyle) { @@ -895,7 +895,7 @@ const std::vector listStyleSheets() return vecStylesheets; } -const std::vector listThemes() +std::vector listThemes() { std::vector vecThemes; for (const auto& it : mapThemeToStyle) { @@ -905,7 +905,7 @@ const std::vector listThemes() return vecThemes; } -const QString getDefaultTheme() +QString getDefaultTheme() { return defaultTheme; } diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index c3fd6a37a8cf..de3b1109ec9f 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -293,13 +293,13 @@ namespace GUIUtil bool isStyleSheetDirectoryCustom(); /** Return a list of all required css files */ - const std::vector listStyleSheets(); + std::vector listStyleSheets(); /** Return a list of all theme css files */ - const std::vector listThemes(); + std::vector listThemes(); /** Return the name of the default theme `*/ - const QString getDefaultTheme(); + QString getDefaultTheme(); /** Check if the given theme name is valid or not */ bool isValidTheme(const QString& strTheme); diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index 0d6d52e67e46..e9f666b506cc 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -70,7 +70,7 @@ Notificator::~Notificator() class FreedesktopImage { public: - FreedesktopImage() {} + FreedesktopImage() = default; explicit FreedesktopImage(const QImage &img); // Image to variant that can be marshalled over DBus diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index eacf650e993a..80f399bd0328 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -43,7 +43,7 @@ class TxViewDelegate : public QAbstractItemDelegate Q_OBJECT public: explicit TxViewDelegate(QObject* parent = nullptr) - : QAbstractItemDelegate(parent), unit(BitcoinUnit::DASH) + : QAbstractItemDelegate(parent) { connect(this, &TxViewDelegate::width_changed, this, &TxViewDelegate::sizeHintChanged); } @@ -126,7 +126,7 @@ class TxViewDelegate : public QAbstractItemDelegate return {ITEM_HEIGHT + 8 + minimum_text_width, ITEM_HEIGHT}; } - BitcoinUnit unit; + BitcoinUnit unit{BitcoinUnit::DASH}; Q_SIGNALS: //! An intermediate signal for emitting from the `paint() const` member function. diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index ecc92e12822e..6adf7fe4cc9b 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -157,9 +157,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : } } -PaymentServer::~PaymentServer() -{ -} +PaymentServer::~PaymentServer() = default; // // OSX-specific way of handling dash: URIs diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index 736dbf6f4fd8..370f40e9931e 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -27,10 +27,7 @@ PeerTableModel::PeerTableModel(interfaces::Node& node, QObject* parent) : refresh(); } -PeerTableModel::~PeerTableModel() -{ - // Intentionally left empty -} +PeerTableModel::~PeerTableModel() = default; void PeerTableModel::startAutoRefresh() { diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index faab8f46ba55..2b86f7aa2ac4 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -34,10 +34,7 @@ RecentRequestsTableModel::RecentRequestsTableModel(WalletModel *parent) : connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &RecentRequestsTableModel::updateDisplayUnit); } -RecentRequestsTableModel::~RecentRequestsTableModel() -{ - /* Intentionally left empty */ -} +RecentRequestsTableModel::~RecentRequestsTableModel() = default; int RecentRequestsTableModel::rowCount(const QModelIndex &parent) const { diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 4308740e5e88..35292d0fc370 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -122,7 +122,7 @@ class QtRPCTimerBase: public QObject, public RPCTimerBase connect(&timer, &QTimer::timeout, [this]{ func(); }); timer.start(millis); } - ~QtRPCTimerBase() {} + ~QtRPCTimerBase() = default; private: QTimer timer; std::function func; @@ -131,7 +131,7 @@ class QtRPCTimerBase: public QObject, public RPCTimerBase class QtRPCTimerInterface: public RPCTimerInterface { public: - ~QtRPCTimerInterface() {} + ~QtRPCTimerInterface() = default; const char *Name() override { return "Qt"; } RPCTimerBase* NewTimer(std::function& func, int64_t millis) override { diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index bb6ac6992289..a1c91b64bd56 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -35,25 +35,51 @@ using wallet::isminetype; QString TransactionDesc::FormatTxStatus(const interfaces::WalletTxStatus& status, bool inMempool) { int depth = status.depth_in_main_chain; - if (depth < 0) return tr("conflicted"); + if (depth < 0) { + /*: Text explaining the current status of a transaction, shown in the + status field of the details window for this transaction. This status + represents an unconfirmed transaction that conflicts with a confirmed + transaction. */ + return tr("conflicted with a transaction with %1 confirmations").arg(-depth); + } QString strTxStatus; bool fChainLocked = status.is_chainlocked; if (depth == 0) { + /*: Text explaining the current status of a transaction, shown in the + status field of the details window for this transaction. This + status represents an abandoned transaction. */ const QString abandoned{status.is_abandoned ? QLatin1String(", ") + tr("abandoned") : QString()}; + /*: Text explaining the current status of a transaction, shown in the + status field of the details window for this transaction. This status + represents an unconfirmed transaction that is in the memory pool. */ strTxStatus = tr("0/unconfirmed, %1").arg((inMempool ? tr("in memory pool") : tr("not in memory pool"))) + abandoned; } else if (!fChainLocked && depth < 6) { + /*: Text explaining the current status of a transaction, shown in the + status field of the details window for this transaction. This status + represents a transaction confirmed in at least one block, + but less than 6 blocks, and still not locked via ChainLocks. */ strTxStatus = tr("%1/unconfirmed").arg(depth); } else { + /*: Text explaining the current status of a transaction, shown in the + status field of the details window for this transaction. This + status represents a transaction confirmed in 6 or more blocks + or locked via ChainLocks. */ strTxStatus = tr("%1 confirmations").arg(depth); if (fChainLocked) { + /*: Text explaining the current status of a transaction, shown in the + status field of the details window for this transaction. This status + represents a transaction confirmed in at least one block and has been locked by ChainLocks. */ strTxStatus += QLatin1String(", ") + tr("locked via ChainLocks"); return strTxStatus; } } if (status.is_islocked) { + /*: Text explaining the current status of a transaction, shown in the + status field of the details window for this transaction. This status + represents an unconfirmed transaction that has been locked by InstantSend. */ strTxStatus += QLatin1String(", ") + tr("verified via InstantSend"); } diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index c0e8d540fd92..d337057b2fb6 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -61,7 +61,7 @@ struct TxLessThan struct TransactionNotification { public: - TransactionNotification() {} + TransactionNotification() = default; TransactionNotification(uint256 _hash, ChangeType _status, bool _showTransaction): hash(_hash), status(_status), showTransaction(_showTransaction) {} diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 3a64e3327d26..9373ab6119df 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -62,9 +62,7 @@ WalletFrame::WalletFrame(QWidget* parent) walletStack->addWidget(governanceListPage); } -WalletFrame::~WalletFrame() -{ -} +WalletFrame::~WalletFrame() = default; void WalletFrame::setClientModel(ClientModel *_clientModel) { diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 38535b920d21..813a2e01c226 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -153,9 +153,7 @@ WalletView::WalletView(WalletModel* wallet_model, QWidget* parent) GUIUtil::disableMacFocusRect(this); } -WalletView::~WalletView() -{ -} +WalletView::~WalletView() = default; void WalletView::setClientModel(ClientModel *_clientModel) { diff --git a/src/random.cpp b/src/random.cpp index 362499abefb1..a7626224603b 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -443,9 +443,7 @@ class RNGState { InitHardwareRand(); } - ~RNGState() - { - } + ~RNGState() = default; void AddEvent(uint32_t event_info) noexcept EXCLUSIVE_LOCKS_REQUIRED(!m_events_mutex) { diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 35e4d54c1f25..d7b736a21575 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2354,9 +2354,9 @@ static std::atomic g_should_abort_scan; class CoinsViewScanReserver { private: - bool m_could_reserve; + bool m_could_reserve{false}; public: - explicit CoinsViewScanReserver() : m_could_reserve(false) {} + explicit CoinsViewScanReserver() = default; bool reserve() { CHECK_NONFATAL(!m_could_reserve); @@ -2759,48 +2759,40 @@ UniValue CreateUTXOSnapshot( return result; } - -void RegisterBlockchainRPCCommands(CRPCTable &t) -{ -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ------------------------ - { "blockchain", &getblockchaininfo, }, - { "blockchain", &getchaintxstats, }, - { "blockchain", &getblockstats, }, - { "blockchain", &getbestblockhash, }, - { "blockchain", &getbestchainlock, }, - { "blockchain", &getblockcount, }, - { "blockchain", &getblock, }, - { "blockchain", &getblockfrompeer, }, - { "blockchain", &getblockhashes, }, - { "blockchain", &getblockhash, }, - { "blockchain", &getblockheader, }, - { "blockchain", &getblockheaders, }, - { "blockchain", &getmerkleblocks, }, - { "blockchain", &getchaintips, }, - { "blockchain", &getdifficulty, }, - { "blockchain", &getspecialtxes, }, - { "blockchain", &gettxout, }, - { "blockchain", &gettxoutsetinfo, }, - { "blockchain", &pruneblockchain, }, - { "blockchain", &verifychain, }, - - { "blockchain", &preciousblock, }, - { "blockchain", &scantxoutset, }, - { "blockchain", &getblockfilter, }, - - /* Not shown in help */ - { "hidden", &invalidateblock, }, - { "hidden", &reconsiderblock, }, - { "hidden", &waitfornewblock, }, - { "hidden", &waitforblock, }, - { "hidden", &waitforblockheight, }, - { "hidden", &syncwithvalidationinterfacequeue, }, - { "hidden", &dumptxoutset, }, -}; -// clang-format on +void RegisterBlockchainRPCCommands(CRPCTable& t) +{ + static const CRPCCommand commands[]{ + {"blockchain", &getblockchaininfo}, + {"blockchain", &getchaintxstats}, + {"blockchain", &getblockstats}, + {"blockchain", &getbestblockhash}, + {"blockchain", &getbestchainlock}, + {"blockchain", &getblockcount}, + {"blockchain", &getblock}, + {"blockchain", &getblockfrompeer}, + {"blockchain", &getblockhashes}, + {"blockchain", &getblockhash}, + {"blockchain", &getblockheader}, + {"blockchain", &getblockheaders}, + {"blockchain", &getmerkleblocks}, + {"blockchain", &getchaintips}, + {"blockchain", &getdifficulty}, + {"blockchain", &getspecialtxes}, + {"blockchain", &gettxout}, + {"blockchain", &gettxoutsetinfo}, + {"blockchain", &pruneblockchain}, + {"blockchain", &verifychain}, + {"blockchain", &preciousblock}, + {"blockchain", &scantxoutset}, + {"blockchain", &getblockfilter}, + {"hidden", &invalidateblock}, + {"hidden", &reconsiderblock}, + {"hidden", &waitfornewblock}, + {"hidden", &waitforblock}, + {"hidden", &waitforblockheight}, + {"hidden", &syncwithvalidationinterfacequeue}, + {"hidden", &dumptxoutset}, + }; for (const auto& c : commands) { t.appendCommand(c.name, &c); } diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index eeb75eba835d..92378a3455a7 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -199,6 +199,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "setwalletflag", 1, "value" }, { "getmempoolancestors", 1, "verbose" }, { "getmempooldescendants", 1, "verbose" }, + { "gettxspendingprevout", 0, "outputs" }, { "logging", 0, "include" }, { "logging", 1, "exclude" }, { "sporkupdate", 1, "value" }, diff --git a/src/rpc/coinjoin.cpp b/src/rpc/coinjoin.cpp index e0367734467a..ef578d726101 100644 --- a/src/rpc/coinjoin.cpp +++ b/src/rpc/coinjoin.cpp @@ -503,35 +503,27 @@ static RPCHelpMan getcoinjoininfo() #ifdef ENABLE_WALLET Span GetWalletCoinJoinRPCCommands() { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "dash", &coinjoin, }, - { "dash", &coinjoin_reset, }, - { "dash", &coinjoin_start, }, - { "dash", &coinjoin_status, }, - { "dash", &coinjoin_stop, }, - { "dash", &coinjoinsalt, }, - { "dash", &coinjoinsalt_generate, }, - { "dash", &coinjoinsalt_get, }, - { "dash", &coinjoinsalt_set, }, - { "dash", &getcoinjoininfo, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"dash", &coinjoin}, + {"dash", &coinjoin_reset}, + {"dash", &coinjoin_start}, + {"dash", &coinjoin_status}, + {"dash", &coinjoin_stop}, + {"dash", &coinjoinsalt}, + {"dash", &coinjoinsalt_generate}, + {"dash", &coinjoinsalt_get}, + {"dash", &coinjoinsalt_set}, + {"dash", &getcoinjoininfo}, + }; return commands; } #endif // ENABLE_WALLET void RegisterCoinJoinRPCCommands(CRPCTable& t) { -// clang-format off -static const CRPCCommand commands_wallet[] = -{ // category actor (function) - // --------------------- ----------------------- - { "dash", &getcoinjoininfo, }, -}; -// clang-format on + static const CRPCCommand commands_wallet[]{ + {"dash", &getcoinjoininfo}, + }; // If we aren't compiling with wallet support, we still need to register RPCs that are // capable of working without wallet support. We have to do this even if wallet support // is compiled in but is disabled at runtime because runtime disablement prohibits diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 3e0dcc641636..81bf1ecd7814 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -1845,52 +1845,43 @@ static RPCHelpMan bls_help() #ifdef ENABLE_WALLET Span GetWalletEvoRPCCommands() { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "evo", &protx_list, }, - { "evo", &protx_info, }, - { "evo", &protx_register, }, - { "evo", &protx_register_evo, }, - { "evo", &protx_register_fund, }, - { "evo", &protx_register_fund_evo, }, - { "evo", &protx_register_prepare, }, - { "evo", &protx_register_prepare_evo, }, - { "evo", &protx_update_service, }, - { "evo", &protx_update_service_evo, }, - { "evo", &protx_register_submit, }, - { "evo", &protx_update_registrar, }, - { "evo", &protx_revoke, }, - { "hidden", &protx_register_legacy, }, - { "hidden", &protx_register_fund_legacy, }, - { "hidden", &protx_register_prepare_legacy, }, - { "hidden", &protx_update_registrar_legacy, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"evo", &protx_list}, + {"evo", &protx_info}, + {"evo", &protx_register}, + {"evo", &protx_register_evo}, + {"evo", &protx_register_fund}, + {"evo", &protx_register_fund_evo}, + {"evo", &protx_register_prepare}, + {"evo", &protx_register_prepare_evo}, + {"evo", &protx_update_service}, + {"evo", &protx_update_service_evo}, + {"evo", &protx_register_submit}, + {"evo", &protx_update_registrar}, + {"evo", &protx_revoke}, + {"hidden", &protx_register_legacy}, + {"hidden", &protx_register_fund_legacy}, + {"hidden", &protx_register_prepare_legacy}, + {"hidden", &protx_update_registrar_legacy}, + }; return commands; } #endif // ENABLE_WALLET void RegisterEvoRPCCommands(CRPCTable& tableRPC) { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "evo", &bls_help, }, - { "evo", &bls_generate, }, - { "evo", &bls_fromsecret, }, - { "evo", &protx_help, }, - { "evo", &protx_diff, }, - { "evo", &protx_listdiff, }, -}; -static const CRPCCommand commands_wallet[] = -{ - { "evo", &protx_list, }, - { "evo", &protx_info, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"evo", &bls_help}, + {"evo", &bls_generate}, + {"evo", &bls_fromsecret}, + {"evo", &protx_help}, + {"evo", &protx_diff}, + {"evo", &protx_listdiff}, + }; + static const CRPCCommand commands_wallet[]{ + {"evo", &protx_list}, + {"evo", &protx_info}, + }; for (const auto& command : commands) { tableRPC.appendCommand(command.name, &command); } diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index ea66057b457c..abbffc93804a 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -1052,41 +1052,32 @@ static RPCHelpMan getsuperblockbudget() #ifdef ENABLE_WALLET Span GetWalletGovernanceRPCCommands() { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "dash", &gobject_prepare, }, - { "dash", &gobject_list_prepared, }, - { "dash", &gobject_vote_many, }, - { "dash", &gobject_vote_alias, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"dash", &gobject_prepare}, + {"dash", &gobject_list_prepared}, + {"dash", &gobject_vote_many}, + {"dash", &gobject_vote_alias}, + }; return commands; } #endif // ENABLE_WALLET void RegisterGovernanceRPCCommands(CRPCTable &t) { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - /* Dash features */ - { "dash", &getgovernanceinfo, }, - { "dash", &getsuperblockbudget, }, - { "dash", &gobject, }, - { "dash", &gobject_count, }, - { "dash", &gobject_deserialize, }, - { "dash", &gobject_check, }, - { "dash", &gobject_submit, }, - { "dash", &gobject_list, }, - { "dash", &gobject_diff, }, - { "dash", &gobject_get, }, - { "dash", &gobject_getcurrentvotes, }, - { "dash", &voteraw, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"dash", &getgovernanceinfo}, + {"dash", &getsuperblockbudget}, + {"dash", &gobject}, + {"dash", &gobject_count}, + {"dash", &gobject_deserialize}, + {"dash", &gobject_check}, + {"dash", &gobject_submit}, + {"dash", &gobject_list}, + {"dash", &gobject_diff}, + {"dash", &gobject_get}, + {"dash", &gobject_getcurrentvotes}, + {"dash", &voteraw}, + }; for (const auto& command : commands) { t.appendCommand(command.name, &command); } diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 727b20e9ebf5..d3fc88b11f97 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -679,33 +679,25 @@ static RPCHelpMan masternodelist_composite() #ifdef ENABLE_WALLET Span GetWalletMasternodeRPCCommands() { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "dash", &masternode_outputs, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"dash", &masternode_outputs}, + }; return commands; } #endif // ENABLE_WALLET void RegisterMasternodeRPCCommands(CRPCTable &t) { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "dash", &masternode_help, }, - { "dash", &masternodelist_composite, }, - { "dash", &masternodelist, }, - { "dash", &masternode_connect, }, - { "dash", &masternode_count, }, - { "dash", &masternode_status, }, - { "dash", &masternode_payments, }, - { "dash", &masternode_winners, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"dash", &masternode_help}, + {"dash", &masternodelist_composite}, + {"dash", &masternodelist}, + {"dash", &masternode_connect}, + {"dash", &masternode_count}, + {"dash", &masternode_status}, + {"dash", &masternode_payments}, + {"dash", &masternode_winners}, + }; for (const auto& command : commands) { t.appendCommand(command.name, &command); } diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index 165ea861df88..33eef2952162 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -593,6 +593,89 @@ static RPCHelpMan getmempoolentry() }; } +static RPCHelpMan gettxspendingprevout() +{ + return RPCHelpMan{"gettxspendingprevout", + "Scans the mempool to find transactions spending any of the given outputs", + { + {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The transaction outputs that we want to check, and within each, the txid (string) vout (numeric).", + { + {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "", + { + {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"}, + {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"}, + }, + }, + }, + }, + }, + RPCResult{ + RPCResult::Type::ARR, "", "", + { + {RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR_HEX, "txid", "the transaction id of the checked output"}, + {RPCResult::Type::NUM, "vout", "the vout value of the checked output"}, + {RPCResult::Type::STR_HEX, "spendingtxid", /*optional=*/true, "the transaction id of the mempool transaction spending this output (omitted if unspent)"}, + }}, + } + }, + RPCExamples{ + HelpExampleCli("gettxspendingprevout", "\"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":3}]\"") + + HelpExampleRpc("gettxspendingprevout", "\"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":3}]\"") + }, + [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue + { + RPCTypeCheckArgument(request.params[0], UniValue::VARR); + const UniValue& output_params = request.params[0]; + if (output_params.empty()) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, outputs are missing"); + } + + std::vector prevouts; + prevouts.reserve(output_params.size()); + + for (unsigned int idx = 0; idx < output_params.size(); idx++) { + const UniValue& o = output_params[idx].get_obj(); + + RPCTypeCheckObj(o, + { + {"txid", UniValueType(UniValue::VSTR)}, + {"vout", UniValueType(UniValue::VNUM)}, + }, /*fAllowNull=*/false, /*fStrict=*/true); + + const uint256 txid(ParseHashO(o, "txid")); + const int nOutput{o.find_value("vout").getInt()}; + if (nOutput < 0) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout cannot be negative"); + } + + prevouts.emplace_back(txid, nOutput); + } + + const CTxMemPool& mempool = EnsureAnyMemPool(request.context); + LOCK(mempool.cs); + + UniValue result{UniValue::VARR}; + + for (const COutPoint& prevout : prevouts) { + UniValue o(UniValue::VOBJ); + o.pushKV("txid", prevout.hash.ToString()); + o.pushKV("vout", (uint64_t)prevout.n); + + const CTransaction* spendingTx = mempool.GetConflictTx(prevout); + if (spendingTx != nullptr) { + o.pushKV("spendingtxid", spendingTx->GetHash().ToString()); + } + + result.push_back(o); + } + + return result; + }, + }; +} + UniValue MempoolInfoToJSON(const CTxMemPool& pool, const llmq::CInstantSendManager& isman) { // Make sure this call is atomic in the pool. @@ -683,13 +766,12 @@ static RPCHelpMan savemempool() void RegisterMempoolRPCCommands(CRPCTable& t) { static const CRPCCommand commands[]{ - // category actor (function) - // -------- ---------------- {"rawtransactions", &sendrawtransaction}, {"rawtransactions", &testmempoolaccept}, {"blockchain", &getmempoolancestors}, {"blockchain", &getmempooldescendants}, {"blockchain", &getmempoolentry}, + {"blockchain", &gettxspendingprevout}, {"blockchain", &getmempoolinfo}, {"blockchain", &getrawmempool}, {"blockchain", &savemempool}, diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index d055d17d7bfd..74cb13e40db7 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -978,10 +978,10 @@ class submitblock_StateCatcher final : public CValidationInterface { public: uint256 hash; - bool found; + bool found{false}; BlockValidationState state; - explicit submitblock_StateCatcher(const uint256 &hashIn) : hash(hashIn), found(false), state() {} + explicit submitblock_StateCatcher(const uint256 &hashIn) : hash(hashIn), state() {} protected: void BlockChecked(const CBlock& block, const BlockValidationState& stateIn) override { @@ -1094,24 +1094,18 @@ static RPCHelpMan submitheader() void RegisterMiningRPCCommands(CRPCTable& t) { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "mining", &getnetworkhashps, }, - { "mining", &getmininginfo, }, - { "mining", &prioritisetransaction, }, - { "mining", &getblocktemplate, }, - { "mining", &submitblock, }, - { "mining", &submitheader, }, - - { "hidden", &generatetoaddress, }, - { "hidden", &generatetodescriptor, }, - { "hidden", &generateblock, }, - - { "hidden", &generate, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"mining", &getnetworkhashps}, + {"mining", &getmininginfo}, + {"mining", &prioritisetransaction}, + {"mining", &getblocktemplate}, + {"mining", &submitblock}, + {"mining", &submitheader}, + {"hidden", &generatetoaddress}, + {"hidden", &generatetodescriptor}, + {"hidden", &generateblock}, + {"hidden", &generate}, + }; for (const auto& c : commands) { t.appendCommand(c.name, &c); } diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index e77eeba6cb8d..fbd72f6c349d 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -1112,31 +1112,26 @@ static RPCHelpMan setmnthreadactive() void RegisterNetRPCCommands(CRPCTable &t) { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor - // --------------------- ----------------------- - { "network", &getconnectioncount, }, - { "network", &ping, }, - { "network", &getpeerinfo, }, - { "network", &addnode, }, - { "network", &disconnectnode, }, - { "network", &getaddednodeinfo, }, - { "network", &getnettotals, }, - { "network", &getnetworkinfo, }, - { "network", &setban, }, - { "network", &listbanned, }, - { "network", &clearbanned, }, - { "network", &setnetworkactive, }, - { "network", &getnodeaddresses, }, - - { "hidden", &cleardiscouraged, }, - { "hidden", &addconnection, }, - { "hidden", &addpeeraddress, }, - { "hidden", &sendmsgtopeer }, - { "hidden", &setmnthreadactive }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"network", &getconnectioncount}, + {"network", &ping}, + {"network", &getpeerinfo}, + {"network", &addnode}, + {"network", &disconnectnode}, + {"network", &getaddednodeinfo}, + {"network", &getnettotals}, + {"network", &getnetworkinfo}, + {"network", &setban}, + {"network", &listbanned}, + {"network", &clearbanned}, + {"network", &setnetworkactive}, + {"network", &getnodeaddresses}, + {"hidden", &cleardiscouraged}, + {"hidden", &addconnection}, + {"hidden", &addpeeraddress}, + {"hidden", &sendmsgtopeer}, + {"hidden", &setmnthreadactive}, + }; for (const auto& c : commands) { t.appendCommand(c.name, &c); } diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index a9b3b88d3455..b12b738f9046 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -1155,32 +1155,28 @@ static RPCHelpMan submitchainlock() void RegisterQuorumsRPCCommands(CRPCTable &tableRPC) { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "evo", &quorum_help, }, - { "evo", &quorum_list, }, - { "evo", &quorum_list_extended, }, - { "evo", &quorum_info, }, - { "evo", &quorum_dkginfo, }, - { "evo", &quorum_dkgstatus, }, - { "evo", &quorum_memberof, }, - { "evo", &quorum_sign, }, - { "evo", &quorum_platformsign, }, - { "evo", &quorum_verify, }, - { "evo", &quorum_hasrecsig, }, - { "evo", &quorum_getrecsig, }, - { "evo", &quorum_isconflicting, }, - { "evo", &quorum_selectquorum, }, - { "evo", &quorum_dkgsimerror, }, - { "evo", &quorum_getdata, }, - { "evo", &quorum_rotationinfo, }, - { "evo", &submitchainlock, }, - { "evo", &verifychainlock, }, - { "evo", &verifyislock, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"evo", &quorum_help}, + {"evo", &quorum_list}, + {"evo", &quorum_list_extended}, + {"evo", &quorum_info}, + {"evo", &quorum_dkginfo}, + {"evo", &quorum_dkgstatus}, + {"evo", &quorum_memberof}, + {"evo", &quorum_sign}, + {"evo", &quorum_platformsign}, + {"evo", &quorum_verify}, + {"evo", &quorum_hasrecsig}, + {"evo", &quorum_getrecsig}, + {"evo", &quorum_isconflicting}, + {"evo", &quorum_selectquorum}, + {"evo", &quorum_dkgsimerror}, + {"evo", &quorum_getdata}, + {"evo", &quorum_rotationinfo}, + {"evo", &submitchainlock}, + {"evo", &verifychainlock}, + {"evo", &verifyislock}, + }; for (const auto& command : commands) { tableRPC.appendCommand(command.name, &command); } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 77de92f39f67..379e56a39e50 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1909,32 +1909,28 @@ static RPCHelpMan analyzepsbt() }; } -void RegisterRawTransactionRPCCommands(CRPCTable &t) +void RegisterRawTransactionRPCCommands(CRPCTable& t) { -// clang-format off -static const CRPCCommand commands[] = -{ // category actor (function) - // --------------------- ----------------------- - { "rawtransactions", &getassetunlockstatuses, }, - { "rawtransactions", &getrawtransaction, }, - { "rawtransactions", &getrawtransactionmulti, }, - { "rawtransactions", &getislocks, }, - { "rawtransactions", &gettxchainlocks, }, - { "rawtransactions", &createrawtransaction, }, - { "rawtransactions", &decoderawtransaction, }, - { "rawtransactions", &decodescript, }, - { "rawtransactions", &combinerawtransaction, }, - { "rawtransactions", &signrawtransactionwithkey, }, - { "rawtransactions", &decodepsbt, }, - { "rawtransactions", &combinepsbt, }, - { "rawtransactions", &finalizepsbt, }, - { "rawtransactions", &createpsbt, }, - { "rawtransactions", &converttopsbt, }, - { "rawtransactions", &utxoupdatepsbt, }, - { "rawtransactions", &joinpsbts, }, - { "rawtransactions", &analyzepsbt, }, -}; -// clang-format on + static const CRPCCommand commands[]{ + {"rawtransactions", &getassetunlockstatuses}, + {"rawtransactions", &getrawtransaction}, + {"rawtransactions", &getrawtransactionmulti}, + {"rawtransactions", &getislocks}, + {"rawtransactions", &gettxchainlocks}, + {"rawtransactions", &createrawtransaction}, + {"rawtransactions", &decoderawtransaction}, + {"rawtransactions", &decodescript}, + {"rawtransactions", &combinerawtransaction}, + {"rawtransactions", &signrawtransactionwithkey}, + {"rawtransactions", &decodepsbt}, + {"rawtransactions", &combinepsbt}, + {"rawtransactions", &finalizepsbt}, + {"rawtransactions", &createpsbt}, + {"rawtransactions", &converttopsbt}, + {"rawtransactions", &utxoupdatepsbt}, + {"rawtransactions", &joinpsbts}, + {"rawtransactions", &analyzepsbt}, + }; for (const auto& c : commands) { t.appendCommand(c.name, &c); } diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 80e07ad9b1d5..55c79374acea 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -266,17 +266,14 @@ static RPCHelpMan getrpcinfo() } }; } -// clang-format off -static const CRPCCommand vRPCCommands[] = -{ // category actor (function) - // --------------------- ----------------------- + +static const CRPCCommand vRPCCommands[]{ /* Overall control/query calls */ - { "control", &getrpcinfo, }, - { "control", &help, }, - { "control", &stop, }, - { "control", &uptime, }, + {"control", &getrpcinfo}, + {"control", &help}, + {"control", &stop}, + {"control", &uptime}, }; -// clang-format on CRPCTable::CRPCTable() { diff --git a/src/rpc/txoutproof.cpp b/src/rpc/txoutproof.cpp index 45de1e39d2c0..168a47cb1a87 100644 --- a/src/rpc/txoutproof.cpp +++ b/src/rpc/txoutproof.cpp @@ -177,8 +177,6 @@ static RPCHelpMan verifytxoutproof() void RegisterTxoutProofRPCCommands(CRPCTable& t) { static const CRPCCommand commands[]{ - // category actor (function) - // -------- ---------------- {"blockchain", &gettxoutproof}, {"blockchain", &verifytxoutproof}, }; diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 482caccec770..90ee7464c17e 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -297,8 +297,7 @@ CTxDestination AddAndGetMultisigDestination(const int required, const std::vecto class DescribeAddressVisitor { public: - - explicit DescribeAddressVisitor() {} + explicit DescribeAddressVisitor() = default; UniValue operator()(const CNoDestination &dest) const { return UniValue(UniValue::VOBJ); } diff --git a/src/scheduler.cpp b/src/scheduler.cpp index 9774c2b37256..c0cdfd99b64a 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -11,9 +11,7 @@ #include #include -CScheduler::CScheduler() -{ -} +CScheduler::CScheduler() = default; CScheduler::~CScheduler() { diff --git a/src/script/sign.cpp b/src/script/sign.cpp index d58286fbabf7..ab46a35ec428 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -347,7 +347,7 @@ namespace { class DummySignatureChecker final : public BaseSignatureChecker { public: - DummySignatureChecker() {} + DummySignatureChecker() = default; bool CheckSig(const std::vector& scriptSig, const std::vector& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override { return true; } }; const DummySignatureChecker DUMMY_CHECKER; diff --git a/src/script/standard.h b/src/script/standard.h index 650b95fac890..1b047f1925ce 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_SCRIPT_STANDARD_H #define BITCOIN_SCRIPT_STANDARD_H +#include #include