summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Taaki <genjix@riseup.net>2014-05-09 11:32:25 (GMT)
committer Amir Taaki <genjix@riseup.net>2014-05-09 11:32:25 (GMT)
commitafbdc51835d0d480a1f61eba5b161f5ba53c1fc4 (patch)
treef98a6ff94de856a6fe02d490bc0f9e4bf5cb210d
parent75a3c4f5375ee68fc433dedce0f5b1e6ab171def (diff)
uncast_type and cast_chunk are removed now in libbitcoin.
-rw-r--r--src/client/interface/client_blockchain.cpp2
-rw-r--r--src/client/interface/client_interface.cpp2
-rw-r--r--src/message.cpp4
-rw-r--r--src/worker/publisher.cpp2
-rw-r--r--src/worker/worker.cpp3
5 files changed, 7 insertions, 6 deletions
diff --git a/src/client/interface/client_blockchain.cpp b/src/client/interface/client_blockchain.cpp
index 571852a..722a484 100644
--- a/src/client/interface/client_blockchain.cpp
+++ b/src/client/interface/client_blockchain.cpp
@@ -60,7 +60,7 @@ void wrap_fetch_block_header(const data_chunk& data,
void blockchain_interface::fetch_block_header(size_t height,
bc::blockchain::fetch_handler_block_header handle_fetch)
{
- data_chunk data = uncast_type<uint32_t>(height);
+ data_chunk data = to_data_chunk(to_little_endian<uint32_t>(height));
backend_.request("blockchain.fetch_block_header", data,
std::bind(wrap_fetch_block_header, _1, handle_fetch));
}
diff --git a/src/client/interface/client_interface.cpp b/src/client/interface/client_interface.cpp
index ba388bf..939d665 100644
--- a/src/client/interface/client_interface.cpp
+++ b/src/client/interface/client_interface.cpp
@@ -125,7 +125,7 @@ void subscriber_part::recv_block()
hash_digest blk_hash;
if (!read_hash(blk_hash, parts[0]))
return;
- uint32_t height = cast_chunk<uint32_t>(parts[1]);
+ uint32_t height = from_little_endian<uint32_t>(parts[1].begin());
const data_chunk& raw_blk = parts[2];
block_type blk;
satoshi_load(raw_blk.begin(), raw_blk.end(), blk);
diff --git a/src/message.cpp b/src/message.cpp
index 1357bb6..6676f13 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -30,7 +30,7 @@ bool incoming_message::recv(czmqpp::socket& socket)
const data_chunk& raw_id = *it;
if (raw_id.size() != 4)
return false;
- id_ = cast_chunk<uint32_t>(raw_id);
+ id_ = from_little_endian<uint32_t>(raw_id.begin());
++it;
// [ DATA ]
data_ = *it;
@@ -89,7 +89,7 @@ void outgoing_message::send(czmqpp::socket& socket) const
// [ COMMAND ]
append_str(message, command_);
// [ ID ]
- data_chunk raw_id = uncast_type(id_);
+ data_chunk raw_id = to_data_chunk(to_little_endian(id_));
BITCOIN_ASSERT(raw_id.size() == 4);
message.append(raw_id);
// [ DATA ]
diff --git a/src/worker/publisher.cpp b/src/worker/publisher.cpp
index 82f50f0..bbfb0ac 100644
--- a/src/worker/publisher.cpp
+++ b/src/worker/publisher.cpp
@@ -53,7 +53,7 @@ void append_hash(czmqpp::message& message, const hash_digest& hash)
void publisher::send_blk(uint32_t height, const block_type& blk)
{
// Serialize the height.
- data_chunk raw_height = bc::uncast_type(height);
+ data_chunk raw_height = to_data_chunk(to_little_endian(height));
BITCOIN_ASSERT(raw_height.size() == 4);
// Serialize the 80 byte header.
data_chunk raw_blk_header(bc::satoshi_raw_size(blk.header));
diff --git a/src/worker/worker.cpp b/src/worker/worker.cpp
index 0ba8a77..f0dc713 100644
--- a/src/worker/worker.cpp
+++ b/src/worker/worker.cpp
@@ -163,7 +163,8 @@ void request_worker::publish_heartbeat()
{
static uint32_t counter = 0;
czmqpp::message message;
- message.append(uncast_type(counter));
+ data_chunk raw_counter = to_data_chunk(to_little_endian(counter));
+ message.append(raw_counter);
message.send(heartbeat_socket_);
++counter;
}