Skip to content

Commit

Permalink
Fix all compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lateminer committed Nov 19, 2024
1 parent b9b4300 commit cb72cb5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/addrdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -118,7 +118,7 @@ template <typename Data>
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{};
}
Expand Down
7 changes: 7 additions & 0 deletions src/interfaces/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <string>
#include <vector>

#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif

class ArgsManager;
class CBlock;
class CBlockUndo;
Expand Down Expand Up @@ -383,6 +387,9 @@ class Chain

//! Get stake weight.
virtual uint64_t getStakeWeight(const wallet::CWallet& wallet) = 0;

//! Get staking RPC commands.
virtual Span<const CRPCCommand> getStakingRPCCommands() = 0;
#endif
};

Expand Down
4 changes: 4 additions & 0 deletions src/node/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,10 @@ class ChainImpl : public Chain
{
return GetStakeWeight(wallet);
}
Span<const CRPCCommand> getStakingRPCCommands() override
{
return wallet::GetStakingRPCCommands();
}
#endif

bool hasAssumedValidChain() override
Expand Down
7 changes: 7 additions & 0 deletions src/primitives/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class WalletLoaderImpl : public WalletLoader
{
std::vector<Span<const CRPCCommand>> 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) {
Expand Down

0 comments on commit cb72cb5

Please sign in to comment.