Merge #10961: Improve readability of DecodeBase58Check(...)

c6a995e Improve readability of DecodeBase58Check(...) (practicalswift)

Pull request description:

  Use the more readable form ...

  ```c++
  &vchRet[vchRet.size() - 4]
  ```

  ... instead of ...

  ```c++
  &v.end()[-n]
  ```

  Has the added benefit of eliminating a spurious static analyzer warning about improper use of negative values.

Tree-SHA512: 5895310c189e9322082c28f34342ff9a6c238e2cae3f204521111c8a7981bc555af60b42de082c91608c1125dfc244a65c4faf929249a067a51435e2be74cb39
pull/476/merge
Wladimir J. van der Laan 7 years ago
commit da0478e6e5
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

@ -139,7 +139,7 @@ bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet)
}
// re-calculate the checksum, ensure it matches the included 4-byte checksum
uint256 hash = Hash(vchRet.begin(), vchRet.end() - 4);
if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) {
if (memcmp(&hash, &vchRet[vchRet.size() - 4], 4) != 0) {
vchRet.clear();
return false;
}

Loading…
Cancel
Save