diff --git a/include/bitcoin/system/impl/stream/streamers/hex_writer.ipp b/include/bitcoin/system/impl/stream/streamers/hex_writer.ipp index 8053008279..f88843ea7b 100644 --- a/include/bitcoin/system/impl/stream/streamers/hex_writer.ipp +++ b/include/bitcoin/system/impl/stream/streamers/hex_writer.ipp @@ -52,7 +52,6 @@ template void hex_writer::do_write_bytes(const uint8_t* data, size_t size) NOEXCEPT { - BC_ASSERT(!is_null(data)); BC_ASSERT(!is_multiply_overflow(size, octet_width)); char chars[octet_width]{}; diff --git a/src/chain/block.cpp b/src/chain/block.cpp index a6ea38bca1..367e5bfdb7 100644 --- a/src/chain/block.cpp +++ b/src/chain/block.cpp @@ -671,13 +671,17 @@ static uint64_t block_subsidy(size_t height, uint64_t subsidy_interval, uint64_t block::fees() const NOEXCEPT { + if (txs_->empty()) + return {}; + // Overflow returns max_uint64. const auto value = [](uint64_t total, const auto& tx) NOEXCEPT { return ceilinged_add(total, tx->fee()); }; - return std::accumulate(txs_->begin(), txs_->end(), uint64_t{}, value); + return std::accumulate(std::next(txs_->begin()), txs_->end(), + uint64_t{}, value); } uint64_t block::claim() const NOEXCEPT diff --git a/src/chain/header.cpp b/src/chain/header.cpp index 16d7d9d340..725a204cbb 100644 --- a/src/chain/header.cpp +++ b/src/chain/header.cpp @@ -386,7 +386,7 @@ DEFINE_JSON_FROM_TAG(header) { value = { - // hash is meta property + // hash is computed property { "hash", encode_hash(instance.hash()) }, { "version", instance.version() }, { "previous", encode_hash(instance.previous_block_hash()) }, diff --git a/src/chain/transaction.cpp b/src/chain/transaction.cpp index e244a4dadf..19cd5601e2 100644 --- a/src/chain/transaction.cpp +++ b/src/chain/transaction.cpp @@ -969,7 +969,7 @@ DEFINE_JSON_FROM_TAG(transaction) { value = { - // hash is meta property + // hash is computed property { "hash", encode_hash(instance.hash(false)) }, { "version", instance.version() }, { "inputs", value_from(*instance.inputs_ptr()) },