Skip to content

Commit

Permalink
Merge pull request #657 from evoskuil/master
Browse files Browse the repository at this point in the history
Fix ec vs. code incorrect local var dereference.
  • Loading branch information
evoskuil authored Jun 28, 2024
2 parents 64402ac + fb8bfb5 commit f60e975
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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

0 comments on commit f60e975

Please sign in to comment.