Skip to content

Commit

Permalink
Nit: Fix compiler warning for g++-8 in txmempool.cpp
Browse files Browse the repository at this point in the history
Summary
---

When working on other code, I noticed that on Linux on g++-8, I was
getting the following compiler warning when compiling txmempool.cpp:

    ../src/txmempool.cpp: In lambda function:
    ../src/txmempool.cpp:903:20: warning: declaration of ‘const TxId txId’ shadows a parameter [-Wshadow]
             const TxId txId{txit->GetTx().GetId()};
                        ^~~~
    ../src/txmempool.cpp:893:53: note: shadowed declaration is here
      auto CTxMemPool::recursiveDSProofSearch(const TxId &txId, DspDescendants *desc, double *score) const
                                             ~~~~~~~~~~~~^~~~

This commit fixes the warning.

Test Plan
---

No real changes to this codebase occur here. But:

- `ninja all check check-functional` should do it.
  • Loading branch information
cculianu committed Jun 16, 2021
1 parent 4abadf3 commit c52df0e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/txmempool.cpp
Expand Up @@ -900,8 +900,7 @@ auto CTxMemPool::recursiveDSProofSearch(const TxId &txId, DspDescendants *desc,

// we must use a std::function because lambdas cannot see themselves
std::function<void(txiter)> search = [&](txiter txit) EXCLUSIVE_LOCKS_REQUIRED(cs_main, cs) {
const TxId txId{txit->GetTx().GetId()};
path.push_back(txId);
path.push_back(txit->GetTx().GetId());

if (path.size() > recursionMax || seenTxs.size() > ancestorMax) {
if (score) *score = std::min(0.25, *score);
Expand Down

0 comments on commit c52df0e

Please sign in to comment.