Merge bitcoin/bitcoin#24146: Avoid integer sanitizer warnings in chain.o

fa832103aa Avoid integer sanitizer warnings in chain.o (MarcoFalke)

Pull request description:

  The two changes make the code more self-documenting and also allow to remove 5 file-wide suppressions for the module

ACKs for top commit:
  PastaPastaPasta:
    utACK fa832103aa
  jonatack:
    ACK fa832103aa

Tree-SHA512: d32a06099c56eed9f69130a3209f989872acc593f849528acd7746ee6caa96688cc32de37e8e59ad5d25dcb8912e341f1a43e50642dadeff6ca7624d0873ad10
This commit is contained in:
MarcoFalke
2022-01-31 09:23:49 +01:00
3 changed files with 2 additions and 8 deletions

View File

@@ -151,7 +151,7 @@ int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& fr
if (r.bits() > 63) {
return sign * std::numeric_limits<int64_t>::max();
}
return sign * r.GetLow64();
return sign * int64_t(r.GetLow64());
}
/** Find the last common ancestor two blocks have.

View File

@@ -475,7 +475,7 @@ public:
/** Return the maximal height in the chain. Is equal to chain.Tip() ? chain.Tip()->nHeight : -1. */
int Height() const
{
return vChain.size() - 1;
return int(vChain.size()) - 1;
}
/** Set/initialize a chain with a given tip. */