From cb72cb5f4433d7cd9ec7639b6eecce5622813ffa Mon Sep 17 00:00:00 2001 From: lateminer <9951982+lateminer@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:49:37 +0100 Subject: [PATCH] Fix all compilation errors --- src/addrdb.cpp | 4 ++-- src/interfaces/chain.h | 7 +++++++ src/node/interfaces.cpp | 4 ++++ src/primitives/transaction.cpp | 7 +++++++ src/wallet/interfaces.cpp | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/addrdb.cpp b/src/addrdb.cpp index aab4207237..fd2a363b8a 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -60,7 +60,7 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data // open temp output file fs::path pathTmp = gArgs.GetDataDirNet() / fs::u8path(tmpfn); FILE *file = fsbridge::fopen(pathTmp, "wb"); - CAutoFile fileout{file}; + AutoFile fileout{file}; if (fileout.IsNull()) { fileout.fclose(); remove(pathTmp); @@ -118,7 +118,7 @@ template void DeserializeFileDB(const fs::path& path, Data&& data) { FILE* file = fsbridge::fopen(path, "rb"); - CAutoFile filein{file}; + AutoFile filein{file}; if (filein.IsNull()) { throw DbNotFoundError{}; } diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 98ee47334d..7e20bee64c 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -19,6 +19,10 @@ #include #include +#if defined(HAVE_CONFIG_H) +#include +#endif + class ArgsManager; class CBlock; class CBlockUndo; @@ -383,6 +387,9 @@ class Chain //! Get stake weight. virtual uint64_t getStakeWeight(const wallet::CWallet& wallet) = 0; + + //! Get staking RPC commands. + virtual Span getStakingRPCCommands() = 0; #endif }; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 1dfd1c16b4..486cd68e97 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -854,6 +854,10 @@ class ChainImpl : public Chain { return GetStakeWeight(wallet); } + Span getStakingRPCCommands() override + { + return wallet::GetStakingRPCCommands(); + } #endif bool hasAssumedValidChain() override diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index ec9ce51508..93430c6998 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -73,6 +73,13 @@ Txid CMutableTransaction::GetHash() const return Txid::FromUint256((HashWriter{} << TX_NO_WITNESS(*this)).GetHash()); } +bool CTransaction::ComputeHasWitness() const +{ + return std::any_of(vin.begin(), vin.end(), [](const auto& input) { + return !input.scriptWitness.IsNull(); + }); +} + Txid CTransaction::ComputeHash() const { return Txid::FromUint256((HashWriter{} << TX_NO_WITNESS(*this)).GetHash()); diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 86646b21f9..e761ff70dc 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -591,7 +591,7 @@ class WalletLoaderImpl : public WalletLoader { std::vector> commands; commands.push_back(GetWalletRPCCommands()); - commands.push_back(GetStakingRPCCommands()); + commands.push_back(m_context.chain->getStakingRPCCommands()); for(size_t i = 0; i < commands.size(); i++) { for (const CRPCCommand& command : commands[i]) { m_rpc_commands.emplace_back(command.category, command.name, [this, &command](const JSONRPCRequest& request, UniValue& result, bool last_handler) {