From fa5c896724bb359b4b9a3f89580272bfe5980c1b Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 18 Jun 2021 22:51:36 +0200 Subject: [PATCH 1/2] Add LIFETIMEBOUND to CScript where needed --- src/script/script.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/script/script.h b/src/script/script.h index 974cde49840..8cd1cc38556 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_SCRIPT_SCRIPT_H #define BITCOIN_SCRIPT_SCRIPT_H +#include #include #include #include @@ -438,9 +439,9 @@ public: /** Delete non-existent operator to defend against future introduction */ 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) throw std::runtime_error("CScript::operator<<(): invalid opcode"); @@ -448,13 +449,13 @@ public: return *this; } - CScript& operator<<(const CScriptNum& b) + CScript& operator<<(const CScriptNum& b) LIFETIMEBOUND { *this << b.getvch(); return *this; } - CScript& operator<<(const std::vector& b) + CScript& operator<<(const std::vector& b) LIFETIMEBOUND { if (b.size() < OP_PUSHDATA1) { From fa7e6c56f58678b310898a158053ee9ff8b27fe7 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 3 Sep 2021 13:54:43 +0200 Subject: [PATCH 2/2] Add LIFETIMEBOUND to InitializeChainstate --- src/validation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validation.h b/src/validation.h index ef48156309d..d4fcac1d48a 100644 --- a/src/validation.h +++ b/src/validation.h @@ -929,7 +929,7 @@ public: CChainState& InitializeChainstate( CTxMemPool* mempool, const std::optional& snapshot_blockhash = std::nullopt) - EXCLUSIVE_LOCKS_REQUIRED(::cs_main); + LIFETIMEBOUND EXCLUSIVE_LOCKS_REQUIRED(::cs_main); //! Get all chainstates currently being used. std::vector GetAll();