Skip to content

Commit c449ea9

Browse files
committed
refactor: add gsl::not_null annotation for cached_sml and CalcCbTxMerkleRootMNList
1 parent 151fd41 commit c449ea9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/evo/simplifiedmns.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ bool CSimplifiedMNList::operator==(const CSimplifiedMNList& rhs) const
9696
);
9797
}
9898

99-
bool CalcCbTxMerkleRootMNList(uint256& merkleRootRet, std::shared_ptr<const CSimplifiedMNList> sml,
99+
bool CalcCbTxMerkleRootMNList(uint256& merkleRootRet, gsl::not_null<std::shared_ptr<const CSimplifiedMNList>> sml,
100100
BlockValidationState& state)
101101
{
102102
try {
@@ -105,7 +105,7 @@ bool CalcCbTxMerkleRootMNList(uint256& merkleRootRet, std::shared_ptr<const CSim
105105
int64_t nTime1 = GetTimeMicros();
106106

107107
static Mutex cached_mutex;
108-
static std::shared_ptr<const CSimplifiedMNList> cached_sml GUARDED_BY(cached_mutex){
108+
static gsl::not_null<std::shared_ptr<const CSimplifiedMNList>> cached_sml GUARDED_BY(cached_mutex){
109109
std::make_shared<const CSimplifiedMNList>()};
110110
static uint256 merkleRootCached GUARDED_BY(cached_mutex);
111111
static bool mutatedCached GUARDED_BY(cached_mutex){false};

src/evo/simplifiedmns.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <evo/dmn_types.h>
1010
#include <evo/netinfo.h>
1111
#include <evo/providertx.h>
12+
#include <gsl/pointers.h>
1213
#include <merkleblock.h>
1314
#include <netaddress.h>
1415
#include <pubkey.h>
@@ -107,7 +108,7 @@ class CSimplifiedMNList
107108
bool operator==(const CSimplifiedMNList& rhs) const;
108109
};
109110

110-
bool CalcCbTxMerkleRootMNList(uint256& merkleRootRet, std::shared_ptr<const CSimplifiedMNList> sml,
111+
bool CalcCbTxMerkleRootMNList(uint256& merkleRootRet, gsl::not_null<std::shared_ptr<const CSimplifiedMNList>> sml,
111112
BlockValidationState& state);
112113

113114
#endif // BITCOIN_EVO_SIMPLIFIEDMNS_H

0 commit comments

Comments
 (0)