merge bitcoin#22278: Add LIFETIMEBOUND to CScript where needed

This commit is contained in:
Kittywhiskers Van Gogh 2024-07-05 09:54:38 +00:00
parent 045e178730
commit d19ffd613a
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@
#ifndef BITCOIN_SCRIPT_SCRIPT_H #ifndef BITCOIN_SCRIPT_SCRIPT_H
#define BITCOIN_SCRIPT_SCRIPT_H #define BITCOIN_SCRIPT_SCRIPT_H
#include <attributes.h>
#include <crypto/common.h> #include <crypto/common.h>
#include <prevector.h> #include <prevector.h>
#include <serialize.h> #include <serialize.h>
@ -426,9 +427,9 @@ public:
/** Delete non-existent operator to defend against future introduction */ /** Delete non-existent operator to defend against future introduction */
CScript& operator<<(const CScript& b) = delete; CScript& operator<<(const CScript& b) = delete;
CScript& operator<<(int64_t b) { return push_int64(b); } CScript& operator<<(int64_t b) LIFETIMEBOUND { return push_int64(b); }
CScript& operator<<(opcodetype opcode) CScript& operator<<(opcodetype opcode) LIFETIMEBOUND
{ {
if (opcode < 0 || opcode > 0xff) if (opcode < 0 || opcode > 0xff)
throw std::runtime_error("CScript::operator<<(): invalid opcode"); throw std::runtime_error("CScript::operator<<(): invalid opcode");
@ -436,13 +437,13 @@ public:
return *this; return *this;
} }
CScript& operator<<(const CScriptNum& b) CScript& operator<<(const CScriptNum& b) LIFETIMEBOUND
{ {
*this << b.getvch(); *this << b.getvch();
return *this; return *this;
} }
CScript& operator<<(const std::vector<unsigned char>& b) CScript& operator<<(const std::vector<unsigned char>& b) LIFETIMEBOUND
{ {
if (b.size() < OP_PUSHDATA1) if (b.size() < OP_PUSHDATA1)
{ {

View File

@ -897,7 +897,7 @@ public:
const std::unique_ptr<llmq::CChainLocksHandler>& clhandler, const std::unique_ptr<llmq::CChainLocksHandler>& clhandler,
const std::unique_ptr<llmq::CInstantSendManager>& isman, const std::unique_ptr<llmq::CInstantSendManager>& isman,
const std::optional<uint256>& snapshot_blockhash = std::nullopt) const std::optional<uint256>& snapshot_blockhash = std::nullopt)
EXCLUSIVE_LOCKS_REQUIRED(::cs_main); LIFETIMEBOUND EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
//! Get all chainstates currently being used. //! Get all chainstates currently being used.
std::vector<CChainState*> GetAll(); std::vector<CChainState*> GetAll();