mirror of
				https://git.wownero.com/wownero/wownero.git
				synced 2024-08-15 01:03:23 +00:00 
			
		
		
		
	Explicit namespaces
This commit is contained in:
		
							parent
							
								
									28af03208b
								
							
						
					
					
						commit
						26c83c5dea
					
				
					 1 changed files with 8 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -23,8 +23,6 @@
 | 
			
		|||
#include "crypto/hash.h"
 | 
			
		||||
//#include "serialization/json_archive.h"
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
using namespace epee;
 | 
			
		||||
using namespace cryptonote;
 | 
			
		||||
 | 
			
		||||
DISABLE_VS_WARNINGS(4267)
 | 
			
		||||
| 
						 | 
				
			
			@ -85,14 +83,14 @@ bool blockchain_storage::init(const std::string& config_folder)
 | 
			
		|||
  uint64_t timestamp_diff = time(NULL) - m_blocks.back().bl.timestamp;
 | 
			
		||||
  if(!m_blocks.back().bl.timestamp)
 | 
			
		||||
    timestamp_diff = time(NULL) - 1341378000;
 | 
			
		||||
  LOG_PRINT_GREEN("Blockchain initialized. last block: " << m_blocks.size()-1 << ", " << misc_utils::get_time_interval_string(timestamp_diff) <<  " time ago, current difficulty: " << get_difficulty_for_next_block(), LOG_LEVEL_0);
 | 
			
		||||
  LOG_PRINT_GREEN("Blockchain initialized. last block: " << m_blocks.size() - 1 << ", " << epee::misc_utils::get_time_interval_string(timestamp_diff) << " time ago, current difficulty: " << get_difficulty_for_next_block(), LOG_LEVEL_0);
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
//------------------------------------------------------------------
 | 
			
		||||
bool blockchain_storage::store_blockchain()
 | 
			
		||||
{
 | 
			
		||||
  m_is_blockchain_storing = true;
 | 
			
		||||
  misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler([&](){m_is_blockchain_storing=false;});
 | 
			
		||||
  epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){m_is_blockchain_storing=false;});
 | 
			
		||||
 | 
			
		||||
  LOG_PRINT_L0("Storing blockchain...");
 | 
			
		||||
  if (!tools::create_directories_if_necessary(m_config_folder))
 | 
			
		||||
| 
						 | 
				
			
			@ -517,8 +515,7 @@ bool blockchain_storage::validate_miner_transaction(const block& b, size_t cumul
 | 
			
		|||
 | 
			
		||||
  std::vector<size_t> last_blocks_sizes;
 | 
			
		||||
  get_last_n_blocks_sizes(last_blocks_sizes, CRYPTONOTE_REWARD_BLOCKS_WINDOW);
 | 
			
		||||
  if(!get_block_reward(misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward))
 | 
			
		||||
  {
 | 
			
		||||
  if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward)) {
 | 
			
		||||
    LOG_PRINT_L0("block size " << cumulative_block_size << " is bigger than allowed for this blockchain");
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -707,7 +704,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
 | 
			
		|||
  uint64_t block_height = get_block_height(b);
 | 
			
		||||
  if(0 == block_height)
 | 
			
		||||
  {
 | 
			
		||||
    LOG_ERROR("Block with id: " << string_tools::pod_to_hex(id) << " (as alternative) have wrong miner transaction");
 | 
			
		||||
    LOG_ERROR("Block with id: " << epee::string_tools::pod_to_hex(id) << " (as alternative) have wrong miner transaction");
 | 
			
		||||
    bvc.m_verifivation_failed = true;
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -791,7 +788,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
 | 
			
		|||
 | 
			
		||||
    if(!prevalidate_miner_transaction(b, bei.height))
 | 
			
		||||
    {
 | 
			
		||||
      LOG_PRINT_RED_L0("Block with id: " << string_tools::pod_to_hex(id)
 | 
			
		||||
      LOG_PRINT_RED_L0("Block with id: " << epee::string_tools::pod_to_hex(id)
 | 
			
		||||
        << " (as alternative) have wrong miner transaction.");
 | 
			
		||||
      bvc.m_verifivation_failed = true;
 | 
			
		||||
      return false;
 | 
			
		||||
| 
						 | 
				
			
			@ -1104,7 +1101,7 @@ void blockchain_storage::print_blockchain_outs(const std::string& file)
 | 
			
		|||
        ss << "\t" << vals[i].first << ": " << vals[i].second << ENDL;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if(file_io_utils::save_string_to_file(file, ss.str()))
 | 
			
		||||
  if(epee::file_io_utils::save_string_to_file(file, ss.str()))
 | 
			
		||||
  {
 | 
			
		||||
    LOG_PRINT_L0("Current outputs index writen to file: " << file);
 | 
			
		||||
  }else
 | 
			
		||||
| 
						 | 
				
			
			@ -1352,7 +1349,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
 | 
			
		|||
 | 
			
		||||
    if(have_tx_keyimg_as_spent(in_to_key.k_image))
 | 
			
		||||
    {
 | 
			
		||||
      LOG_PRINT_L1("Key image already spent in blockchain: " << string_tools::pod_to_hex(in_to_key.k_image));
 | 
			
		||||
      LOG_PRINT_L1("Key image already spent in blockchain: " << epee::string_tools::pod_to_hex(in_to_key.k_image));
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1651,7 +1648,7 @@ bool blockchain_storage::update_next_comulative_size_limit()
 | 
			
		|||
  std::vector<size_t> sz;
 | 
			
		||||
  get_last_n_blocks_sizes(sz, CRYPTONOTE_REWARD_BLOCKS_WINDOW);
 | 
			
		||||
 | 
			
		||||
  uint64_t median = misc_utils::median(sz);
 | 
			
		||||
  uint64_t median = epee::misc_utils::median(sz);
 | 
			
		||||
  if(median <= CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE)
 | 
			
		||||
    median = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue