From 35d7ea705d5f8fa1154437feb9236100a9f3e7a7 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Sun, 26 Oct 2014 14:41:18 -0500 Subject: [PATCH] Renaming publish_req since there's no response. --- rai/core/core.cpp | 28 ++++++++++++++-------------- rai/core/core.hpp | 12 ++++++------ rai/secure.cpp | 2 +- rai/secure.hpp | 4 ++-- rai/test/ledger.cpp | 18 +++++++++--------- rai/test/test_network.cpp | 6 +++--- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/rai/core/core.cpp b/rai/core/core.cpp index 42d890a1..61ce04bc 100644 --- a/rai/core/core.cpp +++ b/rai/core/core.cpp @@ -156,7 +156,7 @@ void rai::network::publish_block (boost::asio::ip::udp::endpoint const & endpoin { client.log.add (boost::str (boost::format ("Publish %1% to %2%") % block->hash ().to_string () % endpoint_a)); } - rai::publish_req message (std::move (block)); + rai::publish message (std::move (block)); rai::work work; message.work = work.create (message.block->hash ()); std::shared_ptr > bytes (new std::vector ); @@ -258,9 +258,9 @@ void rai::network::receive_action (boost::system::error_code const & error, size } break; } - case rai::message_type::publish_req: + case rai::message_type::publish: { - rai::publish_req incoming; + rai::publish incoming; rai::bufferstream stream (buffer.data (), size_a); auto error (incoming.deserialize (stream)); receive (); @@ -276,7 +276,7 @@ void rai::network::receive_action (boost::system::error_code const & error, size ++insufficient_work_count; if (insufficient_work_logging ()) { - client.log.add ("Insufficient work for publish_req"); + client.log.add ("Insufficient work for publish"); } } } @@ -406,12 +406,12 @@ void rai::network::merge_peers (std::shared_ptr > const & } } -rai::publish_req::publish_req (std::unique_ptr block_a) : +rai::publish::publish (std::unique_ptr block_a) : block (std::move (block_a)) { } -bool rai::publish_req::deserialize (rai::stream & stream_a) +bool rai::publish::deserialize (rai::stream & stream_a) { rai::message_type type; auto result (read (stream_a, type)); @@ -428,9 +428,9 @@ bool rai::publish_req::deserialize (rai::stream & stream_a) return result; } -void rai::publish_req::serialize (rai::stream & stream_a) +void rai::publish::serialize (rai::stream & stream_a) { - write (stream_a, rai::message_type::publish_req); + write (stream_a, rai::message_type::publish); write (stream_a, work); rai::serialize_block (stream_a, *block); } @@ -1305,9 +1305,9 @@ void rai::keepalive_ack::visit (rai::message_visitor & visitor_a) const visitor_a.keepalive_ack (*this); } -void rai::publish_req::visit (rai::message_visitor & visitor_a) const +void rai::publish::visit (rai::message_visitor & visitor_a) const { - visitor_a.publish_req (*this); + visitor_a.publish (*this); } void rai::keepalive_ack::serialize (rai::stream & stream_a) @@ -2229,7 +2229,7 @@ public: { assert (false); } - void publish_req (rai::publish_req const &) + void publish (rai::publish const &) { assert (false); } @@ -2399,7 +2399,7 @@ public: { assert (false); } - void publish_req (rai::publish_req const &) + void publish (rai::publish const &) { assert (false); } @@ -3602,7 +3602,7 @@ public: }); } } - void publish_req (rai::publish_req const & message_a) override + void publish (rai::publish const & message_a) override { if (network_message_logging ()) { @@ -3845,7 +3845,7 @@ bool rai::confirm_req::operator == (rai::confirm_req const & other_a) const return work == other_a.work && *block == *other_a.block; } -bool rai::publish_req::operator == (rai::publish_req const & other_a) const +bool rai::publish::operator == (rai::publish const & other_a) const { return work == other_a.work && *block == *other_a.block; } diff --git a/rai/core/core.hpp b/rai/core/core.hpp index a0737ae8..db3b2508 100644 --- a/rai/core/core.hpp +++ b/rai/core/core.hpp @@ -122,7 +122,7 @@ namespace rai { not_a_type, keepalive_req, keepalive_ack, - publish_req, + publish, confirm_req, confirm_ack, confirm_unk, @@ -155,15 +155,15 @@ namespace rai { std::array peers; rai::uint256_union checksum; }; - class publish_req : public message + class publish : public message { public: - publish_req () = default; - publish_req (std::unique_ptr ); + publish () = default; + publish (std::unique_ptr ); void visit (rai::message_visitor &) const override; bool deserialize (rai::stream &); void serialize (rai::stream &) override; - bool operator == (rai::publish_req const &) const; + bool operator == (rai::publish const &) const; rai::uint256_union work; std::unique_ptr block; }; @@ -222,7 +222,7 @@ namespace rai { public: virtual void keepalive_req (rai::keepalive_req const &) = 0; virtual void keepalive_ack (rai::keepalive_ack const &) = 0; - virtual void publish_req (rai::publish_req const &) = 0; + virtual void publish (rai::publish const &) = 0; virtual void confirm_req (rai::confirm_req const &) = 0; virtual void confirm_ack (rai::confirm_ack const &) = 0; virtual void confirm_unk (rai::confirm_unk const &) = 0; diff --git a/rai/secure.cpp b/rai/secure.cpp index 6a298f31..a013215b 100644 --- a/rai/secure.cpp +++ b/rai/secure.cpp @@ -1063,7 +1063,7 @@ void rai::account_iterator::set_current () auto slice (iterator->value ()); rai::bufferstream stream (reinterpret_cast (slice.data ()), slice.size ()); auto error (current.second.deserialize (stream)); - assert (!error); + assert (!error); // {TODO} Corrupt db } else { diff --git a/rai/secure.hpp b/rai/secure.hpp index d9145776..af465715 100644 --- a/rai/secure.hpp +++ b/rai/secure.hpp @@ -373,8 +373,8 @@ namespace rai account_iterator latest_end (); void pending_put (rai::block_hash const &, rai::address const &, rai::amount const &, rai::address const &); - void pending_del (rai::identifier const &); - bool pending_get (rai::identifier const &, rai::address &, rai::amount &, rai::address &); + void pending_del (rai::block_hash const &); + bool pending_get (rai::block_hash const &, rai::address &, rai::amount &, rai::address &); bool pending_exists (rai::block_hash const &); rai::uint128_t representation_get (rai::address const &); diff --git a/rai/test/ledger.cpp b/rai/test/ledger.cpp index cb0c416a..6f231e96 100644 --- a/rai/test/ledger.cpp +++ b/rai/test/ledger.cpp @@ -1195,7 +1195,7 @@ TEST (fork, publish) send1->hashables.balance.clear (); send1->hashables.destination = key1.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1->hash (), send1->signature); - rai::publish_req publish1; + rai::publish publish1; publish1.block = std::move (send1); rai::keypair key2; std::unique_ptr send2 (new rai::send_block); @@ -1203,7 +1203,7 @@ TEST (fork, publish) send2->hashables.balance.clear (); send2->hashables.destination = key2.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature); - rai::publish_req publish2; + rai::publish publish2; publish2.block = std::move (send2); client1.processor.process_message (publish1, rai::endpoint {}, true); ASSERT_EQ (0, client1.conflicts.roots.size ()); @@ -1244,7 +1244,7 @@ TEST (fork, keep) send1->hashables.balance.clear (); send1->hashables.destination = key1.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1->hash (), send1->signature); - rai::publish_req publish1; + rai::publish publish1; publish1.block = std::move (send1); rai::keypair key2; std::unique_ptr send2 (new rai::send_block); @@ -1252,7 +1252,7 @@ TEST (fork, keep) send2->hashables.balance.clear (); send2->hashables.destination = key2.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature); - rai::publish_req publish2; + rai::publish publish2; publish2.block = std::move (send2); client1.processor.process_message (publish1, rai::endpoint {}, true); client2.processor.process_message (publish1, rai::endpoint {}, true); @@ -1295,7 +1295,7 @@ TEST (fork, flip) send1->hashables.balance.clear (); send1->hashables.destination = key1.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1->hash (), send1->signature); - rai::publish_req publish1; + rai::publish publish1; publish1.block = std::move (send1); rai::keypair key2; std::unique_ptr send2 (new rai::send_block); @@ -1303,7 +1303,7 @@ TEST (fork, flip) send2->hashables.balance.clear (); send2->hashables.destination = key2.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature); - rai::publish_req publish2; + rai::publish publish2; publish2.block = std::move (send2); client1.processor.process_message (publish1, rai::endpoint {}, true); client2.processor.process_message (publish2, rai::endpoint {}, true); @@ -1347,7 +1347,7 @@ TEST (fork, multi_flip) send1->hashables.balance.clear (); send1->hashables.destination = key1.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send1->hash (), send1->signature); - rai::publish_req publish1; + rai::publish publish1; publish1.block = std::move (send1); rai::keypair key2; std::unique_ptr send2 (new rai::send_block); @@ -1355,14 +1355,14 @@ TEST (fork, multi_flip) send2->hashables.balance.clear (); send2->hashables.destination = key2.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send2->hash (), send2->signature); - rai::publish_req publish2; + rai::publish publish2; publish2.block = std::move (send2); std::unique_ptr send3 (new rai::send_block); send3->hashables.previous = publish2.block->hash (); send3->hashables.balance.clear (); send3->hashables.destination = key2.pub; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, send3->hash (), send3->signature); - rai::publish_req publish3; + rai::publish publish3; publish3.block = std::move (send3); client1.processor.process_message (publish1, rai::endpoint {}, true); client2.processor.process_message (publish2, rai::endpoint {}, true); diff --git a/rai/test/test_network.cpp b/rai/test/test_network.cpp index fbb8db7d..40e29962 100644 --- a/rai/test/test_network.cpp +++ b/rai/test/test_network.cpp @@ -257,13 +257,13 @@ TEST (network, publish_req) block->hashables.previous.clear (); block->hashables.balance = 200; block->hashables.destination = key2.pub; - rai::publish_req req (std::move (block)); + rai::publish req (std::move (block)); std::vector bytes; { rai::vectorstream stream (bytes); req.serialize (stream); } - rai::publish_req req2; + rai::publish req2; rai::bufferstream stream2 (bytes.data (), bytes.size ()); auto error (req2.deserialize (stream2)); ASSERT_FALSE (error); @@ -366,7 +366,7 @@ TEST (network, send_insufficient_work) block->hashables.previous.clear (); block->hashables.balance = 20; rai::sign_message (rai::test_genesis_key.prv, rai::test_genesis_key.pub, block->hash (), block->signature); - rai::publish_req publish; + rai::publish publish; publish.block = std::move (block); std::shared_ptr > bytes (new std::vector ); {