Don't declare de facto const reference variables as non-const
This commit is contained in:
1 parent
1c65c075ee
commit
31b136e580
6 files changed
+8
-8
No files matched your search
+1
-1
@@ -617,7 +617,7 @@ CAddrInfo CAddrMan::SelectTriedCollision_()
|
|||||||
return CAddrInfo();
|
return CAddrInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAddrInfo& newInfo = mapInfo[id_new];
|
const CAddrInfo& newInfo = mapInfo[id_new];
|
||||||
|
|
||||||
// which tried bucket to move the entry to
|
// which tried bucket to move the entry to
|
||||||
int tried_bucket = newInfo.GetTriedBucket(nKey, m_asmap);
|
int tried_bucket = newInfo.GetTriedBucket(nKey, m_asmap);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ NodeContext& EnsureNodeContext(const util::Ref& context)
|
|||||||
|
|
||||||
CTxMemPool& EnsureMemPool(const util::Ref& context)
|
CTxMemPool& EnsureMemPool(const util::Ref& context)
|
||||||
{
|
{
|
||||||
NodeContext& node = EnsureNodeContext(context);
|
const NodeContext& node = EnsureNodeContext(context);
|
||||||
if (!node.mempool) {
|
if (!node.mempool) {
|
||||||
throw JSONRPCError(RPC_CLIENT_MEMPOOL_DISABLED, "Mempool disabled or instance not found");
|
throw JSONRPCError(RPC_CLIENT_MEMPOOL_DISABLED, "Mempool disabled or instance not found");
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ CTxMemPool& EnsureMemPool(const util::Ref& context)
|
|||||||
|
|
||||||
ChainstateManager& EnsureChainman(const util::Ref& context)
|
ChainstateManager& EnsureChainman(const util::Ref& context)
|
||||||
{
|
{
|
||||||
NodeContext& node = EnsureNodeContext(context);
|
const NodeContext& node = EnsureNodeContext(context);
|
||||||
if (!node.chainman) {
|
if (!node.chainman) {
|
||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Node chainman not found");
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Node chainman not found");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -388,7 +388,7 @@ bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, C
|
|||||||
bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType)
|
bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType)
|
||||||
{
|
{
|
||||||
assert(nIn < txTo.vin.size());
|
assert(nIn < txTo.vin.size());
|
||||||
CTxIn& txin = txTo.vin[nIn];
|
const CTxIn& txin = txTo.vin[nIn];
|
||||||
assert(txin.prevout.n < txFrom.vout.size());
|
assert(txin.prevout.n < txFrom.vout.size());
|
||||||
const CTxOut& txout = txFrom.vout[txin.prevout.n];
|
const CTxOut& txout = txFrom.vout[txin.prevout.n];
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -640,7 +640,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
|
|||||||
LockPoints lp;
|
LockPoints lp;
|
||||||
m_view.SetBackend(m_viewmempool);
|
m_view.SetBackend(m_viewmempool);
|
||||||
|
|
||||||
CCoinsViewCache& coins_cache = ::ChainstateActive().CoinsTip();
|
const CCoinsViewCache& coins_cache = ::ChainstateActive().CoinsTip();
|
||||||
// do all inputs exist?
|
// do all inputs exist?
|
||||||
for (const CTxIn& txin : tx.vin) {
|
for (const CTxIn& txin : tx.vin) {
|
||||||
if (!coins_cache.HaveCoinInCache(txin.prevout)) {
|
if (!coins_cache.HaveCoinInCache(txin.prevout)) {
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransacti
|
|||||||
errors.push_back(Untranslated("Invalid or non-wallet transaction id"));
|
errors.push_back(Untranslated("Invalid or non-wallet transaction id"));
|
||||||
return Result::MISC_ERROR;
|
return Result::MISC_ERROR;
|
||||||
}
|
}
|
||||||
CWalletTx& oldWtx = it->second;
|
const CWalletTx& oldWtx = it->second;
|
||||||
|
|
||||||
// make sure the transaction still has no descendants and hasn't been mined in the meantime
|
// make sure the transaction still has no descendants and hasn't been mined in the meantime
|
||||||
Result result = PreconditionChecks(wallet, oldWtx, errors);
|
Result result = PreconditionChecks(wallet, oldWtx, errors);
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ void CWallet::AddToSpends(const uint256& wtxid)
|
|||||||
{
|
{
|
||||||
auto it = mapWallet.find(wtxid);
|
auto it = mapWallet.find(wtxid);
|
||||||
assert(it != mapWallet.end());
|
assert(it != mapWallet.end());
|
||||||
CWalletTx& thisTx = it->second;
|
const CWalletTx& thisTx = it->second;
|
||||||
if (thisTx.IsCoinBase()) // Coinbases don't spend anything!
|
if (thisTx.IsCoinBase()) // Coinbases don't spend anything!
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1053,7 +1053,7 @@ bool CWallet::AbandonTransaction(const uint256& hashTx)
|
|||||||
// Can't mark abandoned if confirmed or in mempool
|
// Can't mark abandoned if confirmed or in mempool
|
||||||
auto it = mapWallet.find(hashTx);
|
auto it = mapWallet.find(hashTx);
|
||||||
assert(it != mapWallet.end());
|
assert(it != mapWallet.end());
|
||||||
CWalletTx& origtx = it->second;
|
const CWalletTx& origtx = it->second;
|
||||||
if (origtx.GetDepthInMainChain() != 0 || origtx.InMempool()) {
|
if (origtx.GetDepthInMainChain() != 0 || origtx.InMempool()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user