mirror of
https://github.com/monero-project/monero.git
synced 2025-07-29 14:48:44 -04:00
functional_tests: add more blockchain related tests
Related to emission, reorgs, getting tx data back, output distribution and histogram
This commit is contained in:
parent
21b1ac1dd2
commit
064ab12340
11 changed files with 399 additions and 77 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(){};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue