Not creating new work when sending confirm_req
This commit is contained in:
parent
14277163ee
commit
918006153b
2 changed files with 11 additions and 16 deletions
|
@ -191,11 +191,10 @@ void rai::network::publish_block (boost::asio::ip::udp::endpoint const & endpoin
|
|||
});
|
||||
}
|
||||
|
||||
void rai::network::send_confirm_req (boost::asio::ip::udp::endpoint const & endpoint_a, rai::block const & block)
|
||||
void rai::network::send_confirm_req (boost::asio::ip::udp::endpoint const & endpoint_a, rai::block const & block, rai::uint256_union const & work_a)
|
||||
{
|
||||
rai::confirm_req message (block.clone ());
|
||||
rai::work work;
|
||||
message.work = work.create (client.store.root (*message.block));
|
||||
message.work = work_a;
|
||||
std::shared_ptr <std::vector <uint8_t>> bytes (new std::vector <uint8_t>);
|
||||
{
|
||||
rai::vectorstream stream (*bytes);
|
||||
|
@ -1035,7 +1034,7 @@ void rai::election::start_request (rai::block const & block_a)
|
|||
auto list (client->peers.list ());
|
||||
for (auto i (list.begin ()), j (list.end ()); i != j; ++i)
|
||||
{
|
||||
client->network.send_confirm_req (i->endpoint, block_a);
|
||||
client->network.send_confirm_req (i->endpoint, block_a, work);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1116,7 +1115,7 @@ namespace
|
|||
class receivable_visitor : public rai::block_visitor
|
||||
{
|
||||
public:
|
||||
receivable_visitor (rai::client & client_a, rai::block const & incoming_a, rai::uint256_union const & work_a) :
|
||||
receivable_visitor (rai::client & client_a, rai::block const & incoming_a, std::function <rai::uint256_union (rai::block const &)> work_a) :
|
||||
client (client_a),
|
||||
incoming (incoming_a),
|
||||
work (work_a)
|
||||
|
@ -1128,7 +1127,7 @@ public:
|
|||
{
|
||||
auto root (incoming.previous ());
|
||||
assert (!root.is_zero ());
|
||||
client.conflicts.start (block_a, work, true);
|
||||
client.conflicts.start (block_a, work (block_a), true);
|
||||
}
|
||||
}
|
||||
void receive_block (rai::receive_block const &) override
|
||||
|
@ -1142,7 +1141,7 @@ public:
|
|||
}
|
||||
rai::client & client;
|
||||
rai::block const & incoming;
|
||||
rai::uint256_union work;
|
||||
std::function <rai::uint256_union (rai::block const &)> work;
|
||||
};
|
||||
|
||||
class progress_log_visitor : public rai::block_visitor
|
||||
|
@ -1200,7 +1199,7 @@ rai::process_result rai::processor::process_receive (rai::block const & block_a,
|
|||
progress_log_visitor logger (client);
|
||||
block_a.visit (logger);
|
||||
}
|
||||
receivable_visitor visitor (client, block_a, work_a (block_a));
|
||||
receivable_visitor visitor (client, block_a, work_a);
|
||||
block_a.visit (visitor);
|
||||
break;
|
||||
}
|
||||
|
@ -3538,9 +3537,7 @@ bool rai::transactions::receive (rai::send_block const & send_a, rai::private_ke
|
|||
rai::sign_message (prv_a, send_a.hashables.destination, receive->hash (), receive->signature);
|
||||
block.reset (receive);
|
||||
}
|
||||
auto root (client.store.root (*block));
|
||||
rai::work work;
|
||||
auto proof (work.create (root));
|
||||
auto proof (client.create_work (*block));
|
||||
client.processor.process_receive_republish (std::move (block), [proof] (rai::block const &) {return proof;}, rai::endpoint {});
|
||||
result = false;
|
||||
}
|
||||
|
@ -3564,9 +3561,7 @@ bool rai::transactions::send (rai::address const & address_a, rai::uint128_t con
|
|||
{
|
||||
for (auto i (blocks.begin ()), j (blocks.end ()); i != j; ++i)
|
||||
{
|
||||
auto root (client.store.root (**i));
|
||||
rai::work work;
|
||||
auto proof (work.create (root));
|
||||
auto proof (client.create_work (**i));
|
||||
client.processor.process_receive_republish (std::move (*i), [proof] (rai::block const &) {return proof;}, rai::endpoint {});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace rai {
|
|||
void vote (rai::vote const &);
|
||||
void announce_vote ();
|
||||
void timeout_action (std::shared_ptr <rai::destructable>);
|
||||
void start_request (rai::block const &);
|
||||
void start_request (rai::block const &);
|
||||
rai::uint256_t uncontested_threshold ();
|
||||
rai::uint256_t contested_threshold ();
|
||||
rai::votes votes;
|
||||
|
@ -466,7 +466,7 @@ namespace rai {
|
|||
void confirm_block (std::unique_ptr <rai::block>, rai::uint256_union const &, uint64_t);
|
||||
void merge_peers (std::array <rai::endpoint, 8> const &);
|
||||
void maintain_keepalive (rai::endpoint const &);
|
||||
void send_confirm_req (rai::endpoint const &, rai::block const &);
|
||||
void send_confirm_req (rai::endpoint const &, rai::block const &, rai::uint256_union const &);
|
||||
void send_buffer (uint8_t const *, size_t, rai::endpoint const &, std::function <void (boost::system::error_code const &, size_t)>);
|
||||
void send_complete (boost::system::error_code const &, size_t);
|
||||
rai::endpoint endpoint ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue