Second attempt at #5478. See discussion there for context.
This pull replaces almost all uses of uint256 and all uses of uint160 to use opaque byte blobs with only the following operations:
- Default initialization to 0, or from a vector of bytes
- Assignment from other blobXXXs
IsNull()compare to special all-zeros valueSetNull()clear to special all-zeros value: Bitcoin needsIsNull()/SetNull()because we often use the all-zeroes value as a marker for errors and empty values.<for sorting in maps.!===test for (in)equalityGetHex/SetHex/ToStringbecause they’re just so usefulbegin()/end()raw access to the datasize()returns a fixed sizeGetSerializeSize()SerializeUnserializeserialization just reads and writes the bytesGetCheapHash()this is similar toGetLow64()and returns part of the value as uint64_t, for cheap hashing when the contents are assumed distributed uniformy random.
arith_uint256 (the old uint256, used for proof-of-work mainly), on the other hand, loses all functionality like raw bytes access and serialization. Its memory should not be accessed directly. This is necessary for #888 (big endian support).
arith_uint160 (the old uint160) is completely removed as Bitcoin Core does no 160-bit integer arithmetic.
For overall steps see commits.