Skip to content

Commit

Permalink
Merge pull request #83 from evoskuil/version2
Browse files Browse the repository at this point in the history
Accommodate change to fetch_block, using shared pointer.
  • Loading branch information
evoskuil committed Dec 21, 2015
2 parents 7e27aa3 + bba6e15 commit e6395bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions include/bitcoin/node/responder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <atomic>
#include <cstddef>
#include <memory>
#include <system_error>
#include <bitcoin/blockchain.hpp>
#include <bitcoin/node/define.hpp>
Expand Down Expand Up @@ -68,8 +69,9 @@ class BCN_API responder
void send_tx_not_found(const hash_digest& tx_hash,
network::channel_ptr node);

void send_block(const std::error_code& ec, const block_type& block,
const hash_digest& block_hash, network::channel_ptr node);
void send_block(const std::error_code& ec,
std::shared_ptr<block_type> block, const hash_digest& block_hash,
network::channel_ptr node);
void send_block_not_found(const hash_digest& block_hash,
network::channel_ptr node);

Expand Down
8 changes: 5 additions & 3 deletions src/responder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <cmath>
#include <functional>
#include <memory>
#include <system_error>
#include <bitcoin/blockchain.hpp>
#include <bitcoin/node/inventory.hpp>
Expand Down Expand Up @@ -173,8 +174,9 @@ void responder::new_block_get_data(const get_data_type& packet,
}

// Should we look in the orphan pool first?
void responder::send_block(const std::error_code& ec, const block_type& block,
const hash_digest& block_hash, channel_ptr node)
void responder::send_block(const std::error_code& ec,
std::shared_ptr<block_type> block, const hash_digest& block_hash,
channel_ptr node)
{
if (ec == error::service_stopped)
return;
Expand Down Expand Up @@ -209,7 +211,7 @@ void responder::send_block(const std::error_code& ec, const block_type& block,
<< "] " << encode_hash(block_hash);
};

node->send(block, send_handler);
node->send(*block, send_handler);
}

void responder::send_block_not_found(const hash_digest& block_hash,
Expand Down

0 comments on commit e6395bb

Please sign in to comment.