Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ec vs. code incorrect local var dereference. #657

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/bitcoin/node/protocols/protocol_block_in_31800.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class BCN_API protocol_block_in_31800

void send_get_data(const map_ptr& map, const job::ptr& job) NOEXCEPT;
network::messages::get_data create_get_data(
const map_ptr& map) const NOEXCEPT;
const database::associations& map) const NOEXCEPT;

void restore(const map_ptr& map) NOEXCEPT;
void do_handle_complete(const code& ec) NOEXCEPT;
Expand Down
22 changes: 11 additions & 11 deletions src/protocols/protocol_block_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace node {
#define CLASS protocol_block_in_31800

using namespace system;
using namespace database;
using namespace network;
using namespace network::messages;
using namespace std::placeholders;
Expand Down Expand Up @@ -246,24 +247,23 @@ void protocol_block_in_31800::send_get_data(const map_ptr& map,

job_ = job;
map_ = map;
SEND(create_get_data(map_), handle_send, _1);
SEND(create_get_data(*map_), handle_send, _1);
}

get_data protocol_block_in_31800::create_get_data(
const map_ptr& map) const NOEXCEPT
const associations& map) const NOEXCEPT
{
get_data getter{};
getter.items.reserve(map->size());
get_data data{};
data.items.reserve(map.size());

// bip144: get_data uses witness constant but inventory does not.
// clang emplace_back bug (no matching constructor), using push_back.
std::for_each(map->pos_begin(), map->pos_end(),
[&](const auto& item) NOEXCEPT
{
getter.items.push_back({ block_type_, item.hash });
});
std::for_each(map.pos_begin(), map.pos_end(), [&](const auto& item) NOEXCEPT
{
data.items.push_back({ block_type_, item.hash });
});

return getter;
return data;
}

// check block
Expand Down Expand Up @@ -318,7 +318,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
return false;
}

if (ec == system::error::block_malleated)
if (code == system::error::block_malleated)
{
LOGR("Malleated block [" << encode_hash(hash) << ":" << height
<< "] from [" << authority() << "] " << code.message());
Expand Down
Loading