diff --git a/src/main.h b/src/main.h index 18042e0..62924a9 100644 --- a/src/main.h +++ b/src/main.h @@ -137,7 +137,7 @@ int64_t GetProofOfStakeReward(int64_t nCoinAge, int64_t nFees); unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime); unsigned int ComputeMinStake(unsigned int nBase, int64_t nTime, unsigned int nBlockTime); int GetNumBlocksOfPeers(); -bool IsInitialBlockDownload(); +[[nodiscard]] bool IsInitialBlockDownload(); std::string GetWarnings(std::string strFor); bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock); uint256 WantedByOrphan(const CBlock* pblockOrphan); @@ -589,7 +589,7 @@ public: /** Check for standard transaction types @return True if all outputs (scriptPubKeys) use only standard transaction forms */ - bool IsStandard() const; + [[nodiscard]] bool IsStandard() const; /** Check for standard transaction types @param[in] mapInputs Map of previous transactions that have outputs we're spending @@ -734,12 +734,12 @@ public: @param[in] fMiner true if called from CreateNewBlock @return Returns true if all checks succeed */ - bool ConnectInputs(CTxDBBase& txdb, const MapPrevTx& inputs, + [[nodiscard]] bool ConnectInputs(CTxDBBase& txdb, const MapPrevTx& inputs, const CBlockIndex* pindexBlock, bool fBlock, bool fMiner, std::vector* pvChecks = nullptr); bool ClientConnectInputs(); - bool CheckTransaction() const; - bool AcceptToMemoryPool(CTxDBBase& txdb, bool fCheckInputs=true, bool* pfMissingInputs=nullptr); + [[nodiscard]] bool CheckTransaction() const; + [[nodiscard]] bool AcceptToMemoryPool(CTxDBBase& txdb, bool fCheckInputs=true, bool* pfMissingInputs=nullptr); bool GetCoinAge(CTxDBBase& txdb, uint64_t& nCoinAge) const; // triangles: get transaction coin age protected: @@ -1137,12 +1137,12 @@ public: bool DisconnectBlock(CTxDBBase& txdb, CBlockIndex* pindex); - bool ConnectBlock(CTxDBBase& txdb, CBlockIndex* pindex, bool fJustCheck=false); + [[nodiscard]] bool ConnectBlock(CTxDBBase& txdb, CBlockIndex* pindex, bool fJustCheck=false); bool ReadFromDisk(const CBlockIndex* pindex, bool fReadTransactions=true); bool SetBestChain(CTxDBBase& txdb, CBlockIndex* pindexNew); bool AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos, const uint256& hashProofOfStake); bool CheckBlock(bool fCheckPOW=true, bool fCheckMerkleRoot=true, bool fCheckSig=true) const; - bool AcceptBlock(); + [[nodiscard]] bool AcceptBlock(); bool GetCoinAge(uint64_t& nCoinAge) const; // triangles: calculate total coin age spent in block bool SignBlock(CWallet& keystore, int64_t nFees); bool CheckBlockSignature() const; diff --git a/src/script.h b/src/script.h index b8d4c63..fde8b03 100644 --- a/src/script.h +++ b/src/script.h @@ -591,17 +591,17 @@ public: bool EvalScript(std::vector >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, int nHashType); bool Solver(const CScript& scriptPubKey, TxnOutType& typeRet, std::vector >& vSolutionsRet); int ScriptSigArgsExpected(TxnOutType t, const std::vector >& vSolutions); -bool IsStandard(const CScript& scriptPubKey); -bool IsMine(const CKeyStore& keystore, const CScript& scriptPubKey); -bool IsMine(const CKeyStore& keystore, const CTxDestination &dest); +[[nodiscard]] bool IsStandard(const CScript& scriptPubKey); +[[nodiscard]] bool IsMine(const CKeyStore& keystore, const CScript& scriptPubKey); +[[nodiscard]] bool IsMine(const CKeyStore& keystore, const CTxDestination &dest); void ExtractAffectedKeys(const CKeyStore &keystore, const CScript& scriptPubKey, std::vector &vKeys); bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet); bool ExtractDestinations(const CScript& scriptPubKey, TxnOutType& typeRet, std::vector& addressRet, int& nRequiredRet); -bool SignSignature(const CKeyStore& keystore, const CScript& fromPubKey, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); -bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); -bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, +[[nodiscard]] bool SignSignature(const CKeyStore& keystore, const CScript& fromPubKey, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); +[[nodiscard]] bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); +[[nodiscard]] bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, int nHashType); -bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, int nHashType); +[[nodiscard]] bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, int nHashType); // Given two sets of signatures for scriptPubKey, possibly with OP_0 placeholders, // combine them intelligently and return the result. diff --git a/src/wallet.h b/src/wallet.h index 058f4e4..05db5f3 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -216,9 +216,9 @@ public: std::set< std::set > GetAddressGroupings(); std::map GetAddressBalances(); - bool IsMine(const CTxIn& txin) const; + [[nodiscard]] bool IsMine(const CTxIn& txin) const; int64_t GetDebit(const CTxIn& txin) const; - bool IsMine(const CTxOut& txout) const + [[nodiscard]] bool IsMine(const CTxOut& txout) const { return ::IsMine(*this, txout.scriptPubKey); } @@ -235,7 +235,7 @@ public: throw std::runtime_error("CWallet::GetChange() : value out of range"); return (IsChange(txout) ? txout.nValue : 0); } - bool IsMine(const CTransaction& tx) const + [[nodiscard]] bool IsMine(const CTransaction& tx) const { for (const CTxOut& txout : tx.vout) if (IsMine(txout) && txout.nValue >= nMinimumInputValue)