From bd3dd170d2f06dad7e80b161dd0b563b6475f33d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 28 Apr 2026 06:04:48 +0000 Subject: [PATCH] Fix Ubuntu 24 daemon build errors --- src/agrarian-cli.cpp | 3 +++ src/chainparams.cpp | 3 ++- src/init.cpp | 6 ++++-- src/kernel.cpp | 7 +++---- src/main.cpp | 12 ++++-------- src/masternode-payments.h | 2 +- src/rpc/blockchain.cpp | 3 +-- src/rpc/server.h | 2 +- src/txdb.h | 2 +- src/validationinterface.cpp | 3 +++ 10 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/agrarian-cli.cpp b/src/agrarian-cli.cpp index 1249a51a..3ab90bfd 100644 --- a/src/agrarian-cli.cpp +++ b/src/agrarian-cli.cpp @@ -26,6 +26,9 @@ #define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */ static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900; +using std::runtime_error; +using std::string; + std::string HelpMessageCli() { string strUsage; diff --git a/src/chainparams.cpp b/src/chainparams.cpp index a7850194..f563b8a6 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -9,7 +9,6 @@ #include "libzerocoin/Params.h" #include "chainparams.h" -#include "chainparamsseeds.h" #include "random.h" #include "util.h" #include "utilstrencodings.h" @@ -26,6 +25,8 @@ struct SeedSpec6 { uint16_t port; }; +#include "chainparamsseeds.h" + /** * Main network */ diff --git a/src/init.cpp b/src/init.cpp index 20b04a82..4caf574c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -343,14 +343,16 @@ bool static Bind(const CService& addr, unsigned int flags) return true; } +static boost::signals2::connection rpcBlockNotifyConnection; + void OnRPCStarted() { - uiInterface.NotifyBlockTip.connect(RPCNotifyBlockChange); + rpcBlockNotifyConnection = uiInterface.NotifyBlockTip.connect(RPCNotifyBlockChange); } void OnRPCStopped() { - uiInterface.NotifyBlockTip.disconnect(RPCNotifyBlockChange); + rpcBlockNotifyConnection.disconnect(); //RPCNotifyBlockChange(0); cvBlockChange.notify_all(); LogPrint("rpc", "RPC stopped.\n"); diff --git a/src/kernel.cpp b/src/kernel.cpp index 234bee07..6d0cf27a 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -253,7 +253,7 @@ bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier, int nStakeModifierTime = pindexFrom->GetBlockTime(); // Enforce PoS start height - if (pindexFrom->nHeight < Params().PoSStartHeight()) { + if (pindexFrom->nHeight < Params().FIRST_POS_BLOCK()) { return error("GetKernelStakeModifier(): PoS not active at block height %d", pindexFrom->nHeight); } @@ -310,8 +310,8 @@ bool Stake(CStakeInput* stakeInput, unsigned int nBits, unsigned int nTimeBlockF int nHeightStart = chainActive.Height(); // Ensure staking begins at the correct height - if (nHeightStart < Params().PoSStartHeight()) { - return error("Stake(): PoS staking attempted before allowed start height %d", Params().PoSStartHeight()); + if (nHeightStart < Params().FIRST_POS_BLOCK()) { + return error("Stake(): PoS staking attempted before allowed start height %d", Params().FIRST_POS_BLOCK()); } if (Params().NetworkID() != CBaseChainParams::REGTEST) { @@ -501,4 +501,3 @@ bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierCheck } return true; } - diff --git a/src/main.cpp b/src/main.cpp index 33e8d1bb..7e196f2c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4109,13 +4109,9 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo return state.Invalid(error("CheckBlock() : block timestamp too far in the future"), REJECT_INVALID, "time-too-new"); - // Add concurrent PoW and PoS validation logic + // Add concurrent PoW and PoS validation logic. Height-dependent PoS/PoW + // window checks are handled in ConnectBlock, where block height is known. if (block.IsProofOfWork() || block.IsProofOfStake()) { - // Allow PoS starting at block 2 - if (block.IsProofOfStake() && block.GetBlockHeight() < 2) - return state.DoS(100, error("CheckBlock() : PoS not allowed before block 2"), - REJECT_INVALID, "bad-pos-before-2"); - // Ensure the block is valid as PoW or PoS if (!block.IsProofOfWork() && !block.IsProofOfStake()) return state.DoS(100, error("CheckBlock() : Invalid block type, not PoW or PoS"), @@ -4928,7 +4924,7 @@ bool ProcessNewBlock(CValidationState& state, CNode* pfrom, CBlock* pblock, CDis return true; } -bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex* const pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot) +bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex* const pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) { AssertLockHeld(cs_main); assert(pindexPrev); @@ -4945,7 +4941,7 @@ bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex // NOTE: CheckBlockHeader is called by CheckBlock if (!ContextualCheckBlockHeader(block, state, pindexPrev)) return false; - if (!CheckBlock(block, state, fCheckPOW, fCheckMerkleRoot)) + if (!CheckBlock(block, state, fCheckPOW, fCheckMerkleRoot, fCheckSig)) return false; if (!ContextualCheckBlock(block, state, pindexPrev)) return false; diff --git a/src/masternode-payments.h b/src/masternode-payments.h index 3e4d1b2b..ec9d7479 100644 --- a/src/masternode-payments.h +++ b/src/masternode-payments.h @@ -155,7 +155,7 @@ public: CMasternodePaymentWinner() : vinMasternode(CTxIn()), nBlockHeight(0), payee(CScript()), vchSig() {} explicit CMasternodePaymentWinner(const CTxIn& vinIn) : vinMasternode(vinIn), nBlockHeight(0), payee(CScript()), vchSig() {} - uint256 GetHash() + uint256 GetHash() const { CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); ss << payee; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 45c27b69..3ee24fa4 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -269,7 +269,7 @@ UniValue getbestblockhash(const UniValue& params, bool fHelp) return chainActive.Tip()->GetBlockHash().GetHex(); } -void RPCNotifyBlockChange(const uint256 hashBlock) +void RPCNotifyBlockChange(const uint256& hashBlock) { CBlockIndex* pindex = nullptr; pindex = mapBlockIndex.at(hashBlock); @@ -1654,4 +1654,3 @@ UniValue getblockindexstats(const UniValue& params, bool fHelp) { return ret; } - diff --git a/src/rpc/server.h b/src/rpc/server.h index ff702c71..1f49dd09 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -355,6 +355,6 @@ bool StartRPC(); void InterruptRPC(); void StopRPC(); std::string JSONRPCExecBatch(const UniValue& vReq); -void RPCNotifyBlockChange(const uint256 nHeight); +void RPCNotifyBlockChange(const uint256& hashBlock); #endif // BITCOIN_RPCSERVER_H diff --git a/src/txdb.h b/src/txdb.h index ff7025cd..3cd583b2 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -90,7 +90,7 @@ public: bool ReadCoinSpend(const uint256& hashSerial, uint256 &txHash); bool EraseCoinMint(const CBigNum& bnPubcoin); bool EraseCoinSpend(const CBigNum& bnSerial); - bool WipeCoins(std::string strType); + bool WipeCoins(const std::string& strType); bool WriteAccumulatorValue(const uint32_t& nChecksum, const CBigNum& bnValue); bool ReadAccumulatorValue(const uint32_t& nChecksum, CBigNum& bnValue); bool EraseAccumulatorValue(const uint32_t& nChecksum); diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index bd2dfe2f..c3bd04e2 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -6,6 +6,9 @@ #include "validationinterface.h" +using boost::placeholders::_1; +using boost::placeholders::_2; + static CMainSignals g_signals; CMainSignals& GetMainSignals()