|
28 | 28 | namespace llmq
|
29 | 29 | {
|
30 | 30 |
|
31 |
| -static const std::string INPUTLOCK_REQUESTID_PREFIX = "inlock"; |
32 |
| -static const std::string ISLOCK_REQUESTID_PREFIX = "islock"; |
| 31 | +static const std::string_view INPUTLOCK_REQUESTID_PREFIX = "inlock"; |
| 32 | +static const std::string_view ISLOCK_REQUESTID_PREFIX = "islock"; |
33 | 33 |
|
34 |
| -static const std::string DB_ISLOCK_BY_HASH = "is_i"; |
35 |
| -static const std::string DB_HASH_BY_TXID = "is_tx"; |
36 |
| -static const std::string DB_HASH_BY_OUTPOINT = "is_in"; |
37 |
| -static const std::string DB_MINED_BY_HEIGHT_AND_HASH = "is_m"; |
38 |
| -static const std::string DB_ARCHIVED_BY_HEIGHT_AND_HASH = "is_a1"; |
39 |
| -static const std::string DB_ARCHIVED_BY_HASH = "is_a2"; |
| 34 | +static const std::string_view DB_ISLOCK_BY_HASH = "is_i"; |
| 35 | +static const std::string_view DB_HASH_BY_TXID = "is_tx"; |
| 36 | +static const std::string_view DB_HASH_BY_OUTPOINT = "is_in"; |
| 37 | +static const std::string_view DB_MINED_BY_HEIGHT_AND_HASH = "is_m"; |
| 38 | +static const std::string_view DB_ARCHIVED_BY_HEIGHT_AND_HASH = "is_a1"; |
| 39 | +static const std::string_view DB_ARCHIVED_BY_HASH = "is_a2"; |
40 | 40 |
|
41 |
| -static const std::string DB_VERSION = "is_v"; |
42 |
| - |
43 |
| -const int CInstantSendDb::CURRENT_VERSION; |
44 |
| -const uint8_t CInstantSendLock::CURRENT_VERSION; |
| 41 | +static const std::string_view DB_VERSION = "is_v"; |
45 | 42 |
|
46 | 43 | std::unique_ptr<CInstantSendManager> quorumInstantSendManager;
|
47 | 44 |
|
@@ -73,7 +70,7 @@ void CInstantSendDb::Upgrade(const CTxMemPool& mempool)
|
73 | 70 | CInstantSendLock islock;
|
74 | 71 |
|
75 | 72 | auto it = std::unique_ptr<CDBIterator>(db->NewIterator());
|
76 |
| - auto firstKey = std::make_tuple(DB_ISLOCK_BY_HASH, uint256()); |
| 73 | + auto firstKey = std::make_tuple(std::string{DB_ISLOCK_BY_HASH}, uint256()); |
77 | 74 | it->Seek(firstKey);
|
78 | 75 | decltype(firstKey) curKey;
|
79 | 76 |
|
@@ -142,9 +139,9 @@ void CInstantSendDb::RemoveInstantSendLock(CDBBatch& batch, const uint256& hash,
|
142 | 139 | }
|
143 | 140 | }
|
144 | 141 |
|
145 |
| -static std::tuple<std::string, uint32_t, uint256> BuildInversedISLockKey(const std::string& k, int nHeight, const uint256& islockHash) |
| 142 | +static std::tuple<std::string, uint32_t, uint256> BuildInversedISLockKey(std::string_view k, int nHeight, const uint256& islockHash) |
146 | 143 | {
|
147 |
| - return std::make_tuple(k, htobe32(std::numeric_limits<uint32_t>::max() - nHeight), islockHash); |
| 144 | + return std::make_tuple(std::string{k}, htobe32(std::numeric_limits<uint32_t>::max() - nHeight), islockHash); |
148 | 145 | }
|
149 | 146 |
|
150 | 147 | void CInstantSendDb::WriteInstantSendLockMined(const uint256& hash, int nHeight)
|
@@ -302,7 +299,7 @@ size_t CInstantSendDb::GetInstantSendLockCount() const
|
302 | 299 | {
|
303 | 300 | LOCK(cs_db);
|
304 | 301 | auto it = std::unique_ptr<CDBIterator>(db->NewIterator());
|
305 |
| - auto firstKey = std::make_tuple(DB_ISLOCK_BY_HASH, uint256()); |
| 302 | + auto firstKey = std::make_tuple(std::string{DB_ISLOCK_BY_HASH}, uint256()); |
306 | 303 |
|
307 | 304 | it->Seek(firstKey);
|
308 | 305 |
|
@@ -382,7 +379,7 @@ std::vector<uint256> CInstantSendDb::GetInstantSendLocksByParent(const uint256&
|
382 | 379 | {
|
383 | 380 | AssertLockHeld(cs_db);
|
384 | 381 | auto it = std::unique_ptr<CDBIterator>(db->NewIterator());
|
385 |
| - auto firstKey = std::make_tuple(DB_HASH_BY_OUTPOINT, COutPoint(parent, 0)); |
| 382 | + auto firstKey = std::make_tuple(std::string{DB_HASH_BY_OUTPOINT}, COutPoint(parent, 0)); |
386 | 383 | it->Seek(firstKey);
|
387 | 384 |
|
388 | 385 | std::vector<uint256> result;
|
@@ -751,7 +748,7 @@ void CInstantSendManager::HandleNewInstantSendLockRecoveredSig(const llmq::CReco
|
751 | 748 | pendingInstantSendLocks.emplace(hash, std::make_pair(-1, islock));
|
752 | 749 | }
|
753 | 750 |
|
754 |
| -PeerMsgRet CInstantSendManager::ProcessMessage(const CNode& pfrom, gsl::not_null<PeerManager*> peerman, const std::string& msg_type, CDataStream& vRecv) |
| 751 | +PeerMsgRet CInstantSendManager::ProcessMessage(const CNode& pfrom, gsl::not_null<PeerManager*> peerman, std::string_view msg_type, CDataStream& vRecv) |
755 | 752 | {
|
756 | 753 | if (IsInstantSendEnabled() && msg_type == NetMsgType::ISDLOCK) {
|
757 | 754 | if (m_peerman == nullptr) {
|
|
0 commit comments