-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Fix various warnings #6133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix various warnings #6133
Conversation
@@ -136,7 +136,7 @@ extern bool fPruneMode; | |||
/** Number of MiB of block files that we're trying to stay below. */ | |||
extern uint64_t nPruneTarget; | |||
/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of chainActive.Tip() will not be pruned. */ | |||
static const signed int MIN_BLOCKS_TO_KEEP = 288; | |||
static const unsigned MIN_BLOCKS_TO_KEEP = 288; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels strange to not see the type in here, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never use unsigned
without type in the code anywhere else, let's just make this unsigned int
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @luke-jr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see 5 other cases in the code, but fine with me.
@@ -496,7 +496,7 @@ void CTxMemPool::removeCoinbaseSpends(const CCoinsViewCache *pcoins, unsigned in | |||
continue; | |||
const CCoins *coins = pcoins->AccessCoins(txin.prevout.hash); | |||
if (fSanityCheck) assert(coins); | |||
if (!coins || (coins->IsCoinBase() && nMemPoolHeight - coins->nHeight < COINBASE_MATURITY)) { | |||
if (!coins || (coins->IsCoinBase() && ((signed long)nMemPoolHeight) - coins->nHeight < COINBASE_MATURITY)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coins->nHeight
is an int, nMempoolHeight
is an unsigned int. Any specific reason for introducing a signed long
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COINBASE_MATURITY is a [signed] int, and we are subtracting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
1ced98a
to
130fd3e
Compare
Untested ACK, needs rebase. |
Found while building on Debian 7
130fd3e
to
e617fe2
Compare
Rebased |
e617fe2 Fix various warnings (Luke Dashjr)
Found while building on Debian 7 Github-Pull: bitcoin#6133 Rebased-From: e617fe2
Found while building on Debian 7 Github-Pull: bitcoin#6133 Rebased-From: e617fe2
Bitcoin 0.12 misc PRs 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6198 - bitcoin/bitcoin#6206 - bitcoin/bitcoin#5927 - bitcoin/bitcoin#6213 - bitcoin/bitcoin#6061 - bitcoin/bitcoin#6283 (partial, remainder was pulled in #929) - bitcoin/bitcoin#6272 - bitcoin/bitcoin#6316 - bitcoin/bitcoin#6133 - bitcoin/bitcoin#6387 - bitcoin/bitcoin#6401 - bitcoin/bitcoin#6434 - bitcoin/bitcoin#6372 - bitcoin/bitcoin#6447 - bitcoin/bitcoin#6149 - bitcoin/bitcoin#6468 Part of #2074.
Found while building on Debian 7
NOTE: There is one remaining warning I was not able to figure out: