Skip to content

Commit 31b136e

Browse files
Don't declare de facto const reference variables as non-const
1 parent 1c65c07 commit 31b136e

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/addrman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ CAddrInfo CAddrMan::SelectTriedCollision_()
617617
return CAddrInfo();
618618
}
619619

620-
CAddrInfo& newInfo = mapInfo[id_new];
620+
const CAddrInfo& newInfo = mapInfo[id_new];
621621

622622
// which tried bucket to move the entry to
623623
int tried_bucket = newInfo.GetTriedBucket(nKey, m_asmap);

src/rpc/blockchain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ NodeContext& EnsureNodeContext(const util::Ref& context)
6565

6666
CTxMemPool& EnsureMemPool(const util::Ref& context)
6767
{
68-
NodeContext& node = EnsureNodeContext(context);
68+
const NodeContext& node = EnsureNodeContext(context);
6969
if (!node.mempool) {
7070
throw JSONRPCError(RPC_CLIENT_MEMPOOL_DISABLED, "Mempool disabled or instance not found");
7171
}
@@ -74,7 +74,7 @@ CTxMemPool& EnsureMemPool(const util::Ref& context)
7474

7575
ChainstateManager& EnsureChainman(const util::Ref& context)
7676
{
77-
NodeContext& node = EnsureNodeContext(context);
77+
const NodeContext& node = EnsureNodeContext(context);
7878
if (!node.chainman) {
7979
throw JSONRPCError(RPC_INTERNAL_ERROR, "Node chainman not found");
8080
}

src/script/sign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, C
388388
bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType)
389389
{
390390
assert(nIn < txTo.vin.size());
391-
CTxIn& txin = txTo.vin[nIn];
391+
const CTxIn& txin = txTo.vin[nIn];
392392
assert(txin.prevout.n < txFrom.vout.size());
393393
const CTxOut& txout = txFrom.vout[txin.prevout.n];
394394

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
640640
LockPoints lp;
641641
m_view.SetBackend(m_viewmempool);
642642

643-
CCoinsViewCache& coins_cache = ::ChainstateActive().CoinsTip();
643+
const CCoinsViewCache& coins_cache = ::ChainstateActive().CoinsTip();
644644
// do all inputs exist?
645645
for (const CTxIn& txin : tx.vin) {
646646
if (!coins_cache.HaveCoinInCache(txin.prevout)) {

src/wallet/feebumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransacti
256256
errors.push_back(Untranslated("Invalid or non-wallet transaction id"));
257257
return Result::MISC_ERROR;
258258
}
259-
CWalletTx& oldWtx = it->second;
259+
const CWalletTx& oldWtx = it->second;
260260

261261
// make sure the transaction still has no descendants and hasn't been mined in the meantime
262262
Result result = PreconditionChecks(wallet, oldWtx, errors);

src/wallet/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ void CWallet::AddToSpends(const uint256& wtxid)
570570
{
571571
auto it = mapWallet.find(wtxid);
572572
assert(it != mapWallet.end());
573-
CWalletTx& thisTx = it->second;
573+
const CWalletTx& thisTx = it->second;
574574
if (thisTx.IsCoinBase()) // Coinbases don't spend anything!
575575
return;
576576

@@ -1053,7 +1053,7 @@ bool CWallet::AbandonTransaction(const uint256& hashTx)
10531053
// Can't mark abandoned if confirmed or in mempool
10541054
auto it = mapWallet.find(hashTx);
10551055
assert(it != mapWallet.end());
1056-
CWalletTx& origtx = it->second;
1056+
const CWalletTx& origtx = it->second;
10571057
if (origtx.GetDepthInMainChain() != 0 || origtx.InMempool()) {
10581058
return false;
10591059
}

0 commit comments

Comments
 (0)