78 assert(compressed_money_amount <= compressed_money_amount_max);
82 constexpr uint256 u256_min{
"0000000000000000000000000000000000000000000000000000000000000000"};
83 constexpr uint256 u256_max{
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"};
84 std::vector v256{u256, u256_min, u256_max};
89 assert(parsed.value() == i64);
112 const unsigned char uch =
static_cast<unsigned char>(
u8);
115 const std::set<int64_t> i64s{i64,
static_cast<int64_t
>(u64)};
118 assert(dynamic_usage == incremental_dynamic_usage * i64s.size());
126 assert(presalted_hasher(u256) == hasher.Finalize());
130 assert(presalted_hasher(u256,
u32) == hasher.Finalize());
137 assert(fixed_hasher.Hash(u256) == hasher.Finalize());
139 assert(fixed_hasher.Hash(u256, data0) == hasher.Finalize());
146 const auto write_normal{[](
SipHasher13UJ& hasher, uint64_t
data,
bool as_jumbo) {
157 write_normal(mixed, data0, b);
158 write_normal(mixed, data1,
u8 & 1);
159 assert(mixed.Finalize() == reference.Finalize());
161 reference.WriteJumbo(u256).Write(data0);
162 assert(mixed.Hash(u256, data0) == reference.Finalize());
168 assert(parsed.value() == i64);
171 if (i32 >= 0 && i32 <= 16) {
175 const std::chrono::seconds seconds{i64};
179 (void)script_num.
getint();
180 (void)script_num.getvch();
194 const CKeyID key_id{u160};
202 stream >> deserialized_u256;
203 assert(u256 == deserialized_u256 && stream.empty());
207 stream >> deserialized_u160;
208 assert(u160 == deserialized_u160 && stream.empty());
210 uint64_t deserialized_u64;
212 stream >> deserialized_u64;
213 assert(u64 == deserialized_u64 && stream.empty());
215 int64_t deserialized_i64;
217 stream >> deserialized_i64;
218 assert(i64 == deserialized_i64 && stream.empty());
220 uint32_t deserialized_u32;
222 stream >> deserialized_u32;
223 assert(
u32 == deserialized_u32 && stream.empty());
225 int32_t deserialized_i32;
227 stream >> deserialized_i32;
228 assert(i32 == deserialized_i32 && stream.empty());
230 uint16_t deserialized_u16;
232 stream >> deserialized_u16;
233 assert(u16 == deserialized_u16 && stream.empty());
235 int16_t deserialized_i16;
237 stream >> deserialized_i16;
238 assert(i16 == deserialized_i16 && stream.empty());
240 uint8_t deserialized_u8;
242 stream >> deserialized_u8;
243 assert(
u8 == deserialized_u8 && stream.empty());
245 int8_t deserialized_i8;
247 stream >> deserialized_i8;
248 assert(i8 == deserialized_i8 && stream.empty());
252 stream >> deserialized_b;
253 assert(b == deserialized_b && stream.empty());
266 assert(u64 == deserialized_u64 && stream.empty());
270 assert(
u32 == deserialized_u32 && stream.empty());
274 assert(
u32 == deserialized_u32be && stream.empty());
278 assert(u16 == deserialized_u16 && stream.empty());
282 assert(
u8 == deserialized_u8 && stream.empty());
291 assert(u64 == deserialized_u64 && stream.empty());
292 }
catch (
const std::ios_base::failure&) {
static constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
bool MoneyRange(const CAmount &nValue)
bool IsSwitchChar(char c)
arith_uint256 UintToArith256(const uint256 &a)
uint256 ArithToUint256(const arith_uint256 &a)
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
const CChainParams & Params()
Return the currently selected parameters.
const Consensus::Params & GetConsensus() const
A reference to a CKey: the Hash160 of its serialized public key.
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
static opcodetype EncodeOP_N(int n)
A reference to a CScript: the Hash160 of its serialization.
General SipHash-2-4 implementation.
Double ended buffer combining vector and stream-like interfaces.
std::vector< T > ConsumeBytes(size_t num_bytes)
Optimized SipHash-2-4 implementation for uint256.
A custom weaker variant of SipHash-1-3 without padding, and supporting "jumbo" inputs.
SipHasher13UJ & Write(uint64_t data) noexcept
Hash a normal 64-bit value.
SipHasher13UJ & WriteJumbo(const uint256 &hash) noexcept
Hash a 256-bit value as a jumbo block.
const std::string & getValStr() const
256-bit unsigned big integer.
uint32_t GetCompact(bool fNegative=false) const
constexpr uint64_t GetUint64(int pos) const
unsigned int size() const
std::string ToString() const
uint64_t GetLow64() const
std::string GetHex() const
Hex encoding of the number (with the most significant digits first).
unsigned int bits() const
Returns the position of the highest bit set plus one, or zero if the value is zero.
static std::optional< uint256 > FromHex(std::string_view str)
static const PrecomputedData data
Precomputed COutPoint and CCoins values.
uint64_t DecompressAmount(uint64_t x)
uint64_t CompressAmount(uint64_t n)
Compress amount.
unsigned int GetSpecialScriptSize(unsigned int nSize)
uint256 ComputeMerkleRoot(std::vector< uint256 > hashes, bool *mutated)
std::string SighashToStr(unsigned char sighash_type)
UniValue ValueFromAmount(const CAmount amount)
void WriteLE32(B *ptr, uint32_t x)
void WriteLE64(B *ptr, uint64_t x)
signed char HexDigit(char c)
FUZZ_TARGET(integer,.init=initialize_integer)
void initialize_integer()
std::optional< CAmount > ParseMoney(const std::string &money_string)
Parse an amount denoted in full coins.
std::string FormatMoney(const CAmount n)
Money parsing/formatting utilities.
static size_t DynamicUsage(const int8_t &v)
Dynamic memory usage for built-in types is zero.
static size_t IncrementalDynamicUsage(const std::set< X, Y > &s)
std::string ToString(const T &t)
Locale-independent version of std::to_string.
bool AdditionOverflow(const T i, const T j) noexcept
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
bool CheckProofOfWorkImpl(uint256 hash, unsigned int nBits, const Consensus::Params ¶ms)
ServiceFlags
nServices flags
static bool MayHaveUsefulAddressDB(ServiceFlags services)
Checks if a peer with the given service flags may be capable of having a robust address-storage DB.
constexpr unsigned int GetSizeOfCompactSize(uint64_t nSize)
Compact Size size < 253 – 1 byte size <= USHRT_MAX – 3 bytes (253 + 2 bytes) size <= UINT_MAX – 5 byt...
uint8_t ser_readdata8(Stream &s)
void ser_writedata32be(Stream &s, uint32_t obj)
void ser_writedata32(Stream &s, uint32_t obj)
void ser_writedata16(Stream &s, uint16_t obj)
void WriteCompactSize(SizeComputer &os, uint64_t nSize)
uint16_t ser_readdata16(Stream &s)
uint64_t ser_readdata64(Stream &s)
void ser_writedata8(Stream &s, uint8_t obj)
uint64_t ReadCompactSize(Stream &is, bool range_check=true)
Decode a CompactSize-encoded variable-length integer.
uint32_t ser_readdata32(Stream &s)
void ser_writedata64(Stream &s, uint64_t obj)
uint32_t ser_readdata32be(Stream &s)
constexpr bool IsDigit(char c)
Tests if the given character is a decimal digit.
constexpr bool IsSpace(char c) noexcept
Tests if the given character is a whitespace character.
Parameters that influence chain consensus.
bool MultiplicationOverflow(const T i, const T j) noexcept
std::string ToUpper(std::string_view str)
Returns the uppercase equivalent of the given string.
std::string ToLower(std::string_view str)
Returns the lowercase equivalent of the given string.
struct timeval MillisToTimeval(int64_t nTimeout)
Convert milliseconds to a struct timeval for e.g.
constexpr int64_t count_seconds(std::chrono::seconds t)
FuzzedDataProvider & fuzzed_data_provider