From 6f2bdf9a6664aace1cc70d7e515ae1ca86fcb075 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Sun, 2 Nov 2014 10:00:34 -0600 Subject: [PATCH] Performing work on root of block so work can be calculated before knowing the next transaction. --- rai/core/core.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rai/core/core.cpp b/rai/core/core.cpp index 95309711..58a72720 100644 --- a/rai/core/core.cpp +++ b/rai/core/core.cpp @@ -173,7 +173,7 @@ void rai::network::publish_block (boost::asio::ip::udp::endpoint const & endpoin } rai::publish message (std::move (block)); rai::work work; - message.work = work.create (message.block->hash ()); + message.work = work.create (client.store.root (*message.block)); std::shared_ptr > bytes (new std::vector ); { rai::vectorstream stream (*bytes); @@ -196,7 +196,7 @@ void rai::network::send_confirm_req (boost::asio::ip::udp::endpoint const & endp { rai::confirm_req message (block.clone ()); rai::work work; - message.work = work.create (message.block->hash ()); + message.work = work.create (client.store.root (*message.block)); std::shared_ptr > bytes (new std::vector ); { rai::vectorstream stream (*bytes); @@ -263,7 +263,7 @@ void rai::network::receive_action (boost::system::error_code const & error, size receive (); if (!error) { - if (!work.validate (incoming.block->hash (), incoming.work)) + if (!work.validate (client.store.root (*incoming.block), incoming.work)) { ++publish_req_count; client.processor.process_message (incoming, sender); @@ -291,7 +291,7 @@ void rai::network::receive_action (boost::system::error_code const & error, size receive (); if (!error) { - if (!work.validate (incoming.block->hash (), incoming.work)) + if (!work.validate (client.store.root (*incoming.block), incoming.work)) { ++confirm_req_count; client.processor.process_message (incoming, sender);