Page MenuHomePhabricator

unsigned int -> size_t in merkleblock-related code
ClosedPublic

Authored by markblundeberg on Jun 23 2019, 20:50.

Details

Summary

A lot of code was using unsigned int for the type used in list
iterators, indices, etc..
This switches to size_t. Note that there is one exception, nTransactions,
which has been explicitly switched to a 32-bit integer as that is what the
serialization protocol demands. If transactions with 4 billion transactions
ever happen, a bit more work will be needed. ;-) (In reality, this part of
the code will need to be rewritten and optimized quite a bit for that
eventuality, if not discarded altogether.)

Also, introduces braces in multiple places (code style).

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markblundeberg added inline comments.
src/test/bloom_tests.cpp
233 ↗(On Diff #9602)

another catch here ... this really should have been uint32_t all along

This revision is now accepted and ready to land.Jun 24 2019, 15:33
src/test/bloom_tests.cpp
236 ↗(On Diff #9602)

Note: it would seem on first glance that this should break on big-endian machines, but this only manually tests an outpoint with n=0, and 0x00000000 is a palindrome. So, this code block will only fail on weird architectures where sizeof(uint32_t) != 4, however that is already being tested for / assumed in serialize_tests.cpp.