aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-11 13:14:44 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-11 13:14:44 +0200
commit083271375ae14bf8b3495c9c3f4490ae29cb9905 (patch)
treef384a6e92c3dbb40c8644275fa121b699b2ce7a6 /src/cryptonote_basic
parente03b9bcdfdb1961e9928b31daa3d548ee5d7291f (diff)
parent0575794f53b3481a08a8d680e80765c1f1b13729 (diff)
downloadmonzero-core-083271375ae14bf8b3495c9c3f4490ae29cb9905.tar.gz
monzero-core-083271375ae14bf8b3495c9c3f4490ae29cb9905.tar.xz
monzero-core-083271375ae14bf8b3495c9c3f4490ae29cb9905.zip
Merge pull request #5383
0575794f console: simple shell over console.py (moneromooo-monero) 047af5c3 console.py: can now connect to several daemons/wallets (moneromooo-monero) 9f9571aa cmake: always detect python, it's neeed for some tests (moneromooo-monero) 8646bd00 functional_tests: exit with 1 if any test fails (moneromooo-monero) 6fd8834d console.py: add tab completion (moneromooo-monero) 04a20cb2 functional_tests: cold signing key images/outputs import/export (moneromooo-monero) 798e3cad functional_tests: add double spend detection tests (moneromooo-monero) 7c657bb2 functional_tests: add alt chains tests (moneromooo-monero) f8be31d2 functional_tests: add wallet creation language tests (moneromooo-monero) 2d68b31f functional_tests: add more wallet tests (moneromooo-monero) 23f86dad python-rpc: add set_log_level and set_log_categories (moneromooo-monero) b3a32d55 functional_tests: add describe_transfer tests (moneromooo-monero) 108f4375 console.py: support connecting to any host, not just 127.0.0.1 (moneromooo-monero) 064ab123 functional_tests: add more blockchain related tests (moneromooo-monero) 21b1ac1d functional_tests: add bans tests (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.h10
-rw-r--r--src/cryptonote_basic/miner.cpp3
-rw-r--r--src/cryptonote_basic/miner.h3
3 files changed, 14 insertions, 2 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.h b/src/cryptonote_basic/cryptonote_format_utils.h
index 3f8eef076..c9de2a56e 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.h
+++ b/src/cryptonote_basic/cryptonote_format_utils.h
@@ -142,6 +142,16 @@ namespace cryptonote
std::string print_money(uint64_t amount, unsigned int decimal_point = -1);
//---------------------------------------------------------------
template<class t_object>
+ bool t_serializable_object_from_blob(t_object& to, const blobdata& b_blob)
+ {
+ std::stringstream ss;
+ ss << b_blob;
+ binary_archive<false> ba(ss);
+ bool r = ::serialization::serialize(ba, to);
+ return r;
+ }
+ //---------------------------------------------------------------
+ template<class t_object>
bool t_serializable_object_to_blob(const t_object& to, blobdata& b_blob)
{
std::stringstream ss;
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index ded6e346f..e6c6bddb6 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -576,7 +576,8 @@ namespace cryptonote
//we lucky!
++m_config.current_extra_message_index;
MGINFO_GREEN("Found block " << get_block_hash(b) << " at height " << height << " for difficulty: " << local_diff);
- if(!m_phandler->handle_block_found(b))
+ cryptonote::block_verification_context bvc;
+ if(!m_phandler->handle_block_found(b, bvc) || !bvc.m_added_to_main_chain)
{
--m_config.current_extra_message_index;
}else
diff --git a/src/cryptonote_basic/miner.h b/src/cryptonote_basic/miner.h
index bbb576fff..285075f51 100644
--- a/src/cryptonote_basic/miner.h
+++ b/src/cryptonote_basic/miner.h
@@ -34,6 +34,7 @@
#include <boost/logic/tribool_fwd.hpp>
#include <atomic>
#include "cryptonote_basic.h"
+#include "verification_context.h"
#include "difficulty.h"
#include "math_helper.h"
#ifdef _WIN32
@@ -45,7 +46,7 @@ namespace cryptonote
struct i_miner_handler
{
- virtual bool handle_block_found(block& b) = 0;
+ virtual bool handle_block_found(block& b, block_verification_context &bvc) = 0;
virtual bool get_block_template(block& b, const account_public_address& adr, difficulty_type& diffic, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce) = 0;
protected:
~i_miner_handler(){};