Skip to content

Commit

Permalink
Remove dead code.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jul 27, 2024
1 parent 9fea514 commit 1161248
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/bitcoin/network/messages/block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct BCT_API block
size_t size(uint32_t version, bool witness) const NOEXCEPT;

system::chain::block::cptr block_ptr;
mutable size_t cached_size{};
////mutable size_t cached_size{};
};

} // namespace messages
Expand Down
12 changes: 4 additions & 8 deletions src/messages/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ typename block::cptr block::deserialize(uint32_t version,
std::advance(start, full);
}

// WARNING: retainer does not track objects shared from block (e.g. tx).
message->block_ptr->set_retainer(memory.get_retainer());
return message;
}
Expand All @@ -97,10 +98,7 @@ block block::deserialize(uint32_t version, reader& source,
if (version < version_minimum || version > version_maximum)
source.invalidate();

const auto start = source.get_read_position();
const auto block_ptr = to_shared<chain::block>(source, witness);
const auto size = source.get_read_position() - start;
return { block_ptr, size };
return { to_shared<chain::block>(source, witness) };
}

bool block::serialize(uint32_t version,
Expand All @@ -116,14 +114,12 @@ void block::serialize(uint32_t BC_DEBUG_ONLY(version), writer& sink,
bool witness) const NOEXCEPT
{
BC_DEBUG_ONLY(const auto bytes = size(version, witness);)
////BC_DEBUG_ONLY(const auto start = sink.get_write_position();)
const auto start = sink.get_write_position();
BC_DEBUG_ONLY(const auto start = sink.get_write_position();)

if (block_ptr)
block_ptr->to_data(sink, witness);

cached_size = sink.get_write_position() - start;
BC_ASSERT(sink && cached_size == bytes);
BC_ASSERT(sink && (sink.get_write_position() - start) == bytes);
}

size_t block::size(uint32_t, bool witness) const NOEXCEPT
Expand Down

0 comments on commit 1161248

Please sign in to comment.