Skip to content

Commit e4ce074

Browse files
committed
fix: follow-up changes for clang-tidy for std::move
1 parent 6e9f37d commit e4ce074

File tree

7 files changed

+22
-30
lines changed

7 files changed

+22
-30
lines changed

src/evo/specialtxman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ bool CSpecialTxProcessor::BuildNewListFromBlock(const CBlock& block, gsl::not_nu
486486
newList.UpdateMN(dmn.proTxHash, newState);
487487
});
488488

489-
mnListRet = std::move(newList);
489+
std::swap(mnListRet, newList);
490490

491491
return true;
492492
}

src/instantsend/instantsend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ instantsend::PendingState CInstantSendManager::ProcessPendingInstantSendLocks()
190190
std::vector<uint256> removed;
191191
removed.reserve(maxCount);
192192

193-
for (const auto& [islockHash, nodeid_islptr_pair] : pendingInstantSendLocks) {
193+
for (auto& [islockHash, nodeid_islptr_pair] : pendingInstantSendLocks) {
194194
// Check if we've reached max count
195195
if (pend.size() >= maxCount) {
196196
ret.m_pending_work = true;

src/llmq/blockprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ bool CQuorumBlockProcessor::GetCommitmentsFromBlock(const CBlock& block, gsl::no
438438

439439
for (const auto& tx : block.vtx) {
440440
if (tx->nType == TRANSACTION_QUORUM_COMMITMENT) {
441-
const auto opt_qc = GetTxPayload<CFinalCommitmentTxPayload>(*tx);
441+
auto opt_qc = GetTxPayload<CFinalCommitmentTxPayload>(*tx);
442442
if (!opt_qc) {
443443
// should not happen as it was verified before processing the block
444444
LogPrint(BCLog::LLMQ, "CQuorumBlockProcessor::%s height=%d GetTxPayload fails\n", __func__, pindex->nHeight);

src/llmq/snapshot.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,10 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
151151
}
152152
}
153153

154-
auto snapshotHMinusC = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinusCIndex);
155-
if (!snapshotHMinusC.has_value()) {
154+
response.quorumSnapshotAtHMinusC = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinusCIndex);
155+
if (!response.quorumSnapshotAtHMinusC.has_value()) {
156156
errorRet = strprintf("Can not find quorum snapshot at H-C");
157157
return false;
158-
} else {
159-
response.quorumSnapshotAtHMinusC = std::move(snapshotHMinusC.value());
160158
}
161159

162160
if (use_legacy_construction) {
@@ -168,12 +166,10 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
168166
}
169167
}
170168

171-
auto snapshotHMinus2C = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinus2CIndex);
172-
if (!snapshotHMinus2C.has_value()) {
169+
response.quorumSnapshotAtHMinus2C = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinus2CIndex);
170+
if (!response.quorumSnapshotAtHMinus2.has_value()) {
173171
errorRet = strprintf("Can not find quorum snapshot at H-2C");
174172
return false;
175-
} else {
176-
response.quorumSnapshotAtHMinus2C = std::move(snapshotHMinus2C.value());
177173
}
178174

179175
if (use_legacy_construction) {
@@ -185,12 +181,10 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
185181
}
186182
}
187183

188-
auto snapshotHMinus3C = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinus3CIndex);
189-
if (!snapshotHMinus3C.has_value()) {
184+
response.quorumSnapshotAtHMinus3C = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinus3CIndex);
185+
if (!response.quorumSnapshotAtHMinus3C.has_value()) {
190186
errorRet = strprintf("Can not find quorum snapshot at H-3C");
191187
return false;
192-
} else {
193-
response.quorumSnapshotAtHMinus3C = std::move(snapshotHMinus3C.value());
194188
}
195189

196190
if (request.extraShare) {
@@ -201,25 +195,22 @@ bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, CQuorumSnapshotMan
201195
return false;
202196
}
203197

204-
auto snapshotHMinus4C = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinus4CIndex);
205-
if (!snapshotHMinus4C.has_value()) {
198+
response.quorumSnapshotAtHMinus4C = qsnapman.GetSnapshotForBlock(llmqType, pBlockHMinus4CIndex);
199+
if (!response.quorumSnapshotAtHMinus4C.has_value()) {
206200
errorRet = strprintf("Can not find quorum snapshot at H-4C");
207201
return false;
208-
} else {
209-
response.quorumSnapshotAtHMinus4C = std::move(snapshotHMinus4C.value());
210202
}
211203

212-
CSimplifiedMNListDiff mn4c;
204+
;
213205
if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman,
214206
GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinus4CIndex,
215207
use_legacy_construction),
216-
pWorkBlockHMinus4CIndex->GetBlockHash(), mn4c, errorRet)) {
208+
pWorkBlockHMinus4CIndex->GetBlockHash(), response.mnListDiffAtHMinus4C, errorRet)) {
217209
return false;
218210
}
219211
if (!use_legacy_construction) {
220212
baseBlockIndexes.push_back(pWorkBlockHMinus4CIndex);
221213
}
222-
response.mnListDiffAtHMinus4C = std::move(mn4c);
223214
} else {
224215
response.extraShare = false;
225216
}

src/masternode/meta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ std::optional<PlatformBanMessage> CMasternodeMetaMan::GetPlatformBan(const uint2
150150
void CMasternodeMetaMan::RememberPlatformBan(const uint256& inv_hash, PlatformBanMessage&& msg)
151151
{
152152
LOCK(cs);
153-
m_seen_platform_bans.insert(inv_hash, std::move(msg));
153+
m_seen_platform_bans.emplace(inv_hash, std::move(msg));
154154
}
155155

156156
std::string MasternodeMetaStore::ToString() const

src/rpc/quorums.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,6 @@ static RPCHelpMan quorum_rotationinfo()
931931
;
932932

933933
llmq::CGetQuorumRotationInfo cmd;
934-
llmq::CQuorumRotationInfo quorumRotationInfoRet;
935934
std::string strError;
936935

937936
cmd.blockRequestHash = ParseHashV(request.params[0], "blockRequestHash");
@@ -951,11 +950,13 @@ static RPCHelpMan quorum_rotationinfo()
951950
}
952951
}
953952

954-
LOCK(cs_main);
955-
956-
if (!BuildQuorumRotationInfo(*CHECK_NONFATAL(node.dmnman), *llmq_ctx.qsnapman, chainman, *llmq_ctx.qman,
957-
*llmq_ctx.quorum_block_processor, cmd, false, quorumRotationInfoRet, strError)) {
958-
throw JSONRPCError(RPC_INVALID_REQUEST, strError);
953+
llmq::CQuorumRotationInfo quorumRotationInfoRet;
954+
{
955+
LOCK(cs_main);
956+
if (!BuildQuorumRotationInfo(*CHECK_NONFATAL(node.dmnman), *llmq_ctx.qsnapman, chainman, *llmq_ctx.qman,
957+
*llmq_ctx.quorum_block_processor, cmd, false, quorumRotationInfoRet, strError)) {
958+
throw JSONRPCError(RPC_INVALID_REQUEST, strError);
959+
}
959960
}
960961

961962
return quorumRotationInfoRet.ToJson();

src/script/descriptor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ class DescriptorImpl : public Descriptor
619619
assert(outscripts.size() == 1);
620620
subscripts.emplace_back(std::move(outscripts[0]));
621621
}
622-
out = Merge(std::move(out), std::move(subprovider));
622+
out = Merge(out, subprovider);
623623

624624
std::vector<CPubKey> pubkeys;
625625
pubkeys.reserve(entries.size());

0 commit comments

Comments
 (0)