Remove compiler warnings (incl from third party headers) (#2072)
* Remove compiler warnings * Fix new warnings in test * Remove new msvc warnings
This commit is contained in:
		
					parent
					
						
							
								7890e4e48d
							
						
					
				
			
			
				commit
				
					
						f8158fc03c
					
				
			
		
					 69 changed files with 179 additions and 502 deletions
				
			
		| 
						 | 
					@ -45,7 +45,7 @@ IncludeCategories:
 | 
				
			||||||
  - Regex:           '<boost/.*>'
 | 
					  - Regex:           '<boost/.*>'
 | 
				
			||||||
    Priority:        4
 | 
					    Priority:        4
 | 
				
			||||||
  # Headers in other third party libraries
 | 
					  # Headers in other third party libraries
 | 
				
			||||||
  - Regex:           '<(gtest|crypto)/([A-Za-z0-9.\/-_])+>'
 | 
					  - Regex:           '<(gtest|crypto|miniupnp)/([A-Za-z0-9.\/-_])+>'
 | 
				
			||||||
    Priority:        3
 | 
					    Priority:        3
 | 
				
			||||||
  # Headers from nano workspace.
 | 
					  # Headers from nano workspace.
 | 
				
			||||||
  - Regex:           '<nano/([A-Za-z0-9.\/-_])+>'
 | 
					  - Regex:           '<nano/([A-Za-z0-9.\/-_])+>'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@ if (WIN32)
 | 
				
			||||||
	endif()
 | 
						endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
else ()
 | 
					else ()
 | 
				
			||||||
	add_compile_options(-Werror=switch)
 | 
						add_compile_options(-Werror)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((${USING_TSAN} AND ${USING_ASAN}) OR
 | 
						if ((${USING_TSAN} AND ${USING_ASAN}) OR
 | 
				
			||||||
	    (${USING_TSAN} AND ${USING_ASAN_INT}))
 | 
						    (${USING_TSAN} AND ${USING_ASAN_INT}))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@
 | 
				
			||||||
	#include <sys/param.h>
 | 
						#include <sys/param.h>
 | 
				
			||||||
	#define DONNA_INLINE inline __attribute__((always_inline))
 | 
						#define DONNA_INLINE inline __attribute__((always_inline))
 | 
				
			||||||
	#define DONNA_NOINLINE __attribute__((noinline))
 | 
						#define DONNA_NOINLINE __attribute__((noinline))
 | 
				
			||||||
 | 
						#undef ALIGN
 | 
				
			||||||
	#define ALIGN(x) __attribute__((aligned(x)))
 | 
						#define ALIGN(x) __attribute__((aligned(x)))
 | 
				
			||||||
	#define ROTL32(a,b) (((a) << (b)) | ((a) >> (32 - b)))
 | 
						#define ROTL32(a,b) (((a) << (b)) | ((a) >> (32 - b)))
 | 
				
			||||||
	#define ROTR32(a,b) (((a) >> (b)) | ((a) << (32 - b)))
 | 
						#define ROTR32(a,b) (((a) >> (b)) | ((a) << (32 - b)))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										13
									
								
								nano/boost/asio.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								nano/boost/asio.hpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(push)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4191)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4242)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <boost/asio.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(pop)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										13
									
								
								nano/boost/beast.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								nano/boost/beast.hpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(push)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4191)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4242)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <boost/beast.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(pop)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										22
									
								
								nano/boost/process.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								nano/boost/process.hpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,22 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef BOOST_PROCESS_SUPPORTED
 | 
				
			||||||
 | 
					#error BOOST_PROCESS_SUPPORTED must be set, check configuration
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if BOOST_PROCESS_SUPPORTED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(push)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4191)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4242)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4244)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <boost/process.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(pop)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										1
									
								
								nano/boost/readme.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								nano/boost/readme.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					These are files which wrap other boost files and suppress compiler warnings associated with them.
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,6 @@ add_executable (core_test
 | 
				
			||||||
	difficulty.cpp
 | 
						difficulty.cpp
 | 
				
			||||||
	entry.cpp
 | 
						entry.cpp
 | 
				
			||||||
	gap_cache.cpp
 | 
						gap_cache.cpp
 | 
				
			||||||
	interface.cpp
 | 
					 | 
				
			||||||
	ipc.cpp
 | 
						ipc.cpp
 | 
				
			||||||
	ledger.cpp
 | 
						ledger.cpp
 | 
				
			||||||
	logger.cpp
 | 
						logger.cpp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
#include <nano/core_test/testutil.hpp>
 | 
					#include <nano/core_test/testutil.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/node/common.hpp>
 | 
					#include <nano/node/common.hpp>
 | 
				
			||||||
#include <nano/node/node.hpp>
 | 
					#include <nano/node/node.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1494,7 +1494,7 @@ TEST (block_store, peers)
 | 
				
			||||||
TEST (block_store, endpoint_key_byte_order)
 | 
					TEST (block_store, endpoint_key_byte_order)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	boost::asio::ip::address_v6 address (boost::asio::ip::address_v6::from_string ("::ffff:127.0.0.1"));
 | 
						boost::asio::ip::address_v6 address (boost::asio::ip::address_v6::from_string ("::ffff:127.0.0.1"));
 | 
				
			||||||
	auto port = 100;
 | 
						uint16_t port = 100;
 | 
				
			||||||
	nano::endpoint_key endpoint_key (address.to_bytes (), port);
 | 
						nano::endpoint_key endpoint_key (address.to_bytes (), port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::vector<uint8_t> bytes;
 | 
						std::vector<uint8_t> bytes;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,14 +8,14 @@ TEST (basic, basic)
 | 
				
			||||||
TEST (asan, DISABLED_memory)
 | 
					TEST (asan, DISABLED_memory)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
// Ignore warning with gcc/clang compilers
 | 
					// Ignore warning with gcc/clang compilers
 | 
				
			||||||
#ifndef MSVC
 | 
					#ifndef _WIN32
 | 
				
			||||||
#pragma GCC diagnostic push
 | 
					#pragma GCC diagnostic push
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Warray-bounds"
 | 
					#pragma GCC diagnostic ignored "-Warray-bounds"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	uint8_t array[1];
 | 
						uint8_t array[1];
 | 
				
			||||||
	auto value (array[-0x800000]);
 | 
						auto value (array[-0x800000]);
 | 
				
			||||||
	(void)value;
 | 
						(void)value;
 | 
				
			||||||
#ifndef MSVC
 | 
					#ifndef _WIN32
 | 
				
			||||||
#pragma GCC diagnostic pop
 | 
					#pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,162 +0,0 @@
 | 
				
			||||||
#include <nano/lib/blocks.hpp>
 | 
					 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					 | 
				
			||||||
#include <nano/lib/work.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <gtest/gtest.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <memory>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_uint128_to_dec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint128_union zero (0);
 | 
					 | 
				
			||||||
	char text[40] = { 0 };
 | 
					 | 
				
			||||||
	xrb_uint128_to_dec (zero.bytes.data (), text);
 | 
					 | 
				
			||||||
	ASSERT_STREQ ("0", text);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_uint256_to_string)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union zero (0);
 | 
					 | 
				
			||||||
	char text[65] = { 0 };
 | 
					 | 
				
			||||||
	xrb_uint256_to_string (zero.bytes.data (), text);
 | 
					 | 
				
			||||||
	ASSERT_STREQ ("0000000000000000000000000000000000000000000000000000000000000000", text);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_uint256_to_address)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union zero (0);
 | 
					 | 
				
			||||||
	char text[66] = { 0 };
 | 
					 | 
				
			||||||
	xrb_uint256_to_address (zero.bytes.data (), text);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Handle both "xrb_" and "nano_" results, since it is not
 | 
					 | 
				
			||||||
	 * specified which is returned
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	auto account_alpha = "1111111111111111111111111111111111111111111111111111hifc8npp";
 | 
					 | 
				
			||||||
	auto prefix = text[0] == 'x' ? "xrb" : "nano";
 | 
					 | 
				
			||||||
	ASSERT_STREQ (boost::str (boost::format ("%1%_%2%") % prefix % account_alpha).c_str (), text);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_uint512_to_string)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint512_union zero (0);
 | 
					 | 
				
			||||||
	char text[129] = { 0 };
 | 
					 | 
				
			||||||
	xrb_uint512_to_string (zero.bytes.data (), text);
 | 
					 | 
				
			||||||
	ASSERT_STREQ ("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", text);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_uint128_from_dec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint128_union zero (0);
 | 
					 | 
				
			||||||
	ASSERT_EQ (0, xrb_uint128_from_dec ("340282366920938463463374607431768211455", zero.bytes.data ()));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_uint128_from_dec ("340282366920938463463374607431768211456", zero.bytes.data ()));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_uint128_from_dec ("3402823669209384634633%4607431768211455", zero.bytes.data ()));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_uint256_from_string)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union zero (0);
 | 
					 | 
				
			||||||
	ASSERT_EQ (0, xrb_uint256_from_string ("0000000000000000000000000000000000000000000000000000000000000000", zero.bytes.data ()));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_uint256_from_string ("00000000000000000000000000000000000000000000000000000000000000000", zero.bytes.data ()));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_uint256_from_string ("000000000000000000000000000%000000000000000000000000000000000000", zero.bytes.data ()));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_uint512_from_string)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint512_union zero (0);
 | 
					 | 
				
			||||||
	ASSERT_EQ (0, xrb_uint512_from_string ("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", zero.bytes.data ()));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_uint512_from_string ("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", zero.bytes.data ()));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_uint512_from_string ("0000000000000000000000000000000000000000000000000000000000%000000000000000000000000000000000000000000000000000000000000000000000", zero.bytes.data ()));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_valid_address)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	ASSERT_EQ (0, xrb_valid_address ("xrb_1111111111111111111111111111111111111111111111111111hifc8npp"));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_valid_address ("xrb_1111111111111111111111111111111111111111111111111111hifc8nppp"));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_valid_address ("xrb_1111111211111111111111111111111111111111111111111111hifc8npp"));
 | 
					 | 
				
			||||||
	ASSERT_EQ (0, xrb_valid_address ("nano_1111111111111111111111111111111111111111111111111111hifc8npp"));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_valid_address ("nano_1111111111111111111111111111111111111111111111111111hifc8nppp"));
 | 
					 | 
				
			||||||
	ASSERT_EQ (1, xrb_valid_address ("nano_1111111211111111111111111111111111111111111111111111hifc8npp"));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_seed_create)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union seed;
 | 
					 | 
				
			||||||
	xrb_generate_random (seed.bytes.data ());
 | 
					 | 
				
			||||||
	ASSERT_FALSE (seed.is_zero ());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_seed_key)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union seed (0);
 | 
					 | 
				
			||||||
	nano::uint256_union prv;
 | 
					 | 
				
			||||||
	xrb_seed_key (seed.bytes.data (), 0, prv.bytes.data ());
 | 
					 | 
				
			||||||
	ASSERT_FALSE (prv.is_zero ());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, xrb_key_account)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union prv (0);
 | 
					 | 
				
			||||||
	nano::uint256_union pub;
 | 
					 | 
				
			||||||
	xrb_key_account (prv.bytes.data (), pub.bytes.data ());
 | 
					 | 
				
			||||||
	ASSERT_FALSE (pub.is_zero ());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, sign_transaction)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::raw_key key;
 | 
					 | 
				
			||||||
	xrb_generate_random (key.data.bytes.data ());
 | 
					 | 
				
			||||||
	nano::uint256_union pub;
 | 
					 | 
				
			||||||
	xrb_key_account (key.data.bytes.data (), pub.bytes.data ());
 | 
					 | 
				
			||||||
	nano::send_block send (0, 0, 0, key, pub, 0);
 | 
					 | 
				
			||||||
	ASSERT_FALSE (nano::validate_message (pub, send.hash (), send.signature));
 | 
					 | 
				
			||||||
	send.signature.bytes[0] ^= 1;
 | 
					 | 
				
			||||||
	ASSERT_TRUE (nano::validate_message (pub, send.hash (), send.signature));
 | 
					 | 
				
			||||||
	auto send_json (send.to_json ());
 | 
					 | 
				
			||||||
	auto transaction (xrb_sign_transaction (send_json.c_str (), key.data.bytes.data ()));
 | 
					 | 
				
			||||||
	boost::property_tree::ptree block_l;
 | 
					 | 
				
			||||||
	std::string transaction_l (transaction);
 | 
					 | 
				
			||||||
	std::stringstream block_stream (transaction_l);
 | 
					 | 
				
			||||||
	boost::property_tree::read_json (block_stream, block_l);
 | 
					 | 
				
			||||||
	auto block (nano::deserialize_block_json (block_l));
 | 
					 | 
				
			||||||
	ASSERT_NE (nullptr, block);
 | 
					 | 
				
			||||||
	auto send1 (dynamic_cast<nano::send_block *> (block.get ()));
 | 
					 | 
				
			||||||
	ASSERT_NE (nullptr, send1);
 | 
					 | 
				
			||||||
	ASSERT_FALSE (nano::validate_message (pub, send.hash (), send1->signature));
 | 
					 | 
				
			||||||
	// Signatures should be non-deterministic
 | 
					 | 
				
			||||||
	auto transaction2 (xrb_sign_transaction (send_json.c_str (), key.data.bytes.data ()));
 | 
					 | 
				
			||||||
	ASSERT_NE (0, strcmp (transaction, transaction2));
 | 
					 | 
				
			||||||
	free (transaction);
 | 
					 | 
				
			||||||
	free (transaction2);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, fail_sign_transaction)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union data (0);
 | 
					 | 
				
			||||||
	xrb_sign_transaction ("", data.bytes.data ());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, work_transaction)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::raw_key key;
 | 
					 | 
				
			||||||
	xrb_generate_random (key.data.bytes.data ());
 | 
					 | 
				
			||||||
	nano::uint256_union pub;
 | 
					 | 
				
			||||||
	xrb_key_account (key.data.bytes.data (), pub.bytes.data ());
 | 
					 | 
				
			||||||
	nano::send_block send (1, 0, 0, key, pub, 0);
 | 
					 | 
				
			||||||
	auto transaction (xrb_work_transaction (send.to_json ().c_str ()));
 | 
					 | 
				
			||||||
	boost::property_tree::ptree block_l;
 | 
					 | 
				
			||||||
	std::string transaction_l (transaction);
 | 
					 | 
				
			||||||
	std::stringstream block_stream (transaction_l);
 | 
					 | 
				
			||||||
	boost::property_tree::read_json (block_stream, block_l);
 | 
					 | 
				
			||||||
	auto block (nano::deserialize_block_json (block_l));
 | 
					 | 
				
			||||||
	ASSERT_NE (nullptr, block);
 | 
					 | 
				
			||||||
	ASSERT_FALSE (nano::work_validate (*block));
 | 
					 | 
				
			||||||
	free (transaction);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (interface, fail_work_transaction)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union data (0);
 | 
					 | 
				
			||||||
	xrb_work_transaction ("");
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -257,7 +257,7 @@ TEST (node, auto_bootstrap)
 | 
				
			||||||
		ASSERT_NO_ERROR (system.poll ());
 | 
							ASSERT_NO_ERROR (system.poll ());
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	system.deadline_set (5s);
 | 
						system.deadline_set (5s);
 | 
				
			||||||
	while (node1->stats.count (nano::stat::type::observer, nano::stat::detail::observer_confirmation_active_quorum, nano::stat::dir::out) < 0 || node1->stats.count (nano::stat::type::observer, nano::stat::detail::observer_confirmation_active_conf_height, nano::stat::dir::out) < 0)
 | 
						while (node1->stats.count (nano::stat::type::observer, nano::stat::detail::observer_confirmation_active_quorum, nano::stat::dir::out) == 0 || node1->stats.count (nano::stat::type::observer, nano::stat::detail::observer_confirmation_active_conf_height, nano::stat::dir::out) == 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ASSERT_NO_ERROR (system.poll ());
 | 
							ASSERT_NO_ERROR (system.poll ());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1635,7 +1635,7 @@ TEST (node, broadcast_elected)
 | 
				
			||||||
			ASSERT_NO_ERROR (ec);
 | 
								ASSERT_NO_ERROR (ec);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		system.deadline_set (5s);
 | 
							system.deadline_set (5s);
 | 
				
			||||||
		while (node1->stats.count (nano::stat::type::observer, nano::stat::detail::observer_confirmation_inactive, nano::stat::dir::out) < 0)
 | 
							while (node1->stats.count (nano::stat::type::observer, nano::stat::detail::observer_confirmation_inactive, nano::stat::dir::out) == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			ASSERT_NO_ERROR (system.poll ());
 | 
								ASSERT_NO_ERROR (system.poll ());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,7 +88,7 @@ TEST (channels, fill_random_clear)
 | 
				
			||||||
TEST (channels, fill_random_full)
 | 
					TEST (channels, fill_random_full)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::system system (24000, 1);
 | 
						nano::system system (24000, 1);
 | 
				
			||||||
	for (auto i (0); i < 100; ++i)
 | 
						for (uint16_t i (0u); i < 100u; ++i)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		system.nodes[0]->network.udp_channels.insert (nano::endpoint (boost::asio::ip::address_v6::loopback (), i), 0);
 | 
							system.nodes[0]->network.udp_channels.insert (nano::endpoint (boost::asio::ip::address_v6::loopback (), i), 0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,15 @@ TEST (socket, concurrent_writes)
 | 
				
			||||||
	std::function<void(std::shared_ptr<nano::socket>)> reader = [&read_count_completion, &total_message_count, &reader](std::shared_ptr<nano::socket> socket_a) {
 | 
						std::function<void(std::shared_ptr<nano::socket>)> reader = [&read_count_completion, &total_message_count, &reader](std::shared_ptr<nano::socket> socket_a) {
 | 
				
			||||||
		auto buff (std::make_shared<std::vector<uint8_t>> ());
 | 
							auto buff (std::make_shared<std::vector<uint8_t>> ());
 | 
				
			||||||
		buff->resize (1);
 | 
							buff->resize (1);
 | 
				
			||||||
 | 
					#ifndef _WIN32
 | 
				
			||||||
 | 
					#pragma GCC diagnostic push
 | 
				
			||||||
 | 
					#if defined(__has_warning)
 | 
				
			||||||
 | 
					#if __has_warning("-Wunused-lambda-capture")
 | 
				
			||||||
 | 
					/** total_message_count is constexpr and a capture isn't needed. However, removing it fails to compile on VS2017 due to a known compiler bug. */
 | 
				
			||||||
 | 
					#pragma GCC diagnostic ignored "-Wunused-lambda-capture"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		socket_a->async_read (buff, 1, [&read_count_completion, &reader, &total_message_count, socket_a, buff](boost::system::error_code const & ec, size_t size_a) {
 | 
							socket_a->async_read (buff, 1, [&read_count_completion, &reader, &total_message_count, socket_a, buff](boost::system::error_code const & ec, size_t size_a) {
 | 
				
			||||||
			if (!ec)
 | 
								if (!ec)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					@ -40,6 +49,9 @@ TEST (socket, concurrent_writes)
 | 
				
			||||||
				std::cerr << "async_read: " << ec.message () << std::endl;
 | 
									std::cerr << "async_read: " << ec.message () << std::endl;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					#ifndef _WIN32
 | 
				
			||||||
 | 
					#pragma GCC diagnostic pop
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v4::any (), 25000);
 | 
						boost::asio::ip::tcp::endpoint endpoint (boost::asio::ip::address_v4::any (), 25000);
 | 
				
			||||||
| 
						 | 
					@ -90,8 +102,15 @@ TEST (socket, concurrent_writes)
 | 
				
			||||||
	std::vector<std::thread> client_threads;
 | 
						std::vector<std::thread> client_threads;
 | 
				
			||||||
	for (int i = 0; i < client_count; i++)
 | 
						for (int i = 0; i < client_count; i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Note: this gives a warning on most compilers because message_count is constexpr and a
 | 
					#ifndef _WIN32
 | 
				
			||||||
		// capture isn't needed. However, removing it fails to compile on VS2017 due to a known compiler bug.
 | 
					#pragma GCC diagnostic push
 | 
				
			||||||
 | 
					#if defined(__has_warning)
 | 
				
			||||||
 | 
					#if __has_warning("-Wunused-lambda-capture")
 | 
				
			||||||
 | 
					/** total_message_count is constexpr and a capture isn't needed. However, removing it fails to compile on VS2017 due to a known compiler bug. */
 | 
				
			||||||
 | 
					#pragma GCC diagnostic ignored "-Wunused-lambda-capture"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		client_threads.emplace_back ([&client, &message_count]() {
 | 
							client_threads.emplace_back ([&client, &message_count]() {
 | 
				
			||||||
			for (int i = 0; i < message_count; i++)
 | 
								for (int i = 0; i < message_count; i++)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					@ -100,6 +119,9 @@ TEST (socket, concurrent_writes)
 | 
				
			||||||
				client->async_write (buff);
 | 
									client->async_write (buff);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					#ifndef _WIN32
 | 
				
			||||||
 | 
					#pragma GCC diagnostic pop
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ASSERT_FALSE (read_count_completion.await_count_for (10s));
 | 
						ASSERT_FALSE (read_count_completion.await_count_for (10s));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
#include <nano/core_test/testutil.hpp>
 | 
					#include <nano/core_test/testutil.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/lib/jsonconfig.hpp>
 | 
					#include <nano/lib/jsonconfig.hpp>
 | 
				
			||||||
#include <nano/secure/common.hpp>
 | 
					#include <nano/secure/common.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -374,36 +373,6 @@ TEST (uint256_union, decode_nano_variant)
 | 
				
			||||||
	ASSERT_FALSE (key.decode_account ("nano_1111111111111111111111111111111111111111111111111111hifc8npp"));
 | 
						ASSERT_FALSE (key.decode_account ("nano_1111111111111111111111111111111111111111111111111111hifc8npp"));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST (uint256_union, decode_account_variations)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	for (int i = 0; i < 100; i++)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		nano::raw_key key;
 | 
					 | 
				
			||||||
		xrb_generate_random (key.data.bytes.data ());
 | 
					 | 
				
			||||||
		nano::uint256_union pub;
 | 
					 | 
				
			||||||
		xrb_key_account (key.data.bytes.data (), pub.bytes.data ());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		char account[66] = { 0 };
 | 
					 | 
				
			||||||
		xrb_uint256_to_address (pub.bytes.data (), account);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/*
 | 
					 | 
				
			||||||
		 * Handle different offsets for the underscore separator
 | 
					 | 
				
			||||||
		 * for "xrb_" prefixed and "nano_" prefixed accounts
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		unsigned offset = (account[0] == 'x') ? 4 : 5;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Replace first digit after xrb_ with '0'..'9', make sure only one of them is valid
 | 
					 | 
				
			||||||
		int errors = 0;
 | 
					 | 
				
			||||||
		for (int variation = 0; variation < 10; variation++)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			account[offset] = static_cast<char> (variation + 48);
 | 
					 | 
				
			||||||
			errors += xrb_valid_address (account);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		ASSERT_EQ (errors, 9);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (uint256_union, account_transcode)
 | 
					TEST (uint256_union, account_transcode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::uint256_union value;
 | 
						nano::uint256_union value;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,5 @@
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
 | 
					#include <nano/boost/beast.hpp>
 | 
				
			||||||
#include <nano/core_test/testutil.hpp>
 | 
					#include <nano/core_test/testutil.hpp>
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					#include <nano/crypto_lib/random_pool.hpp>
 | 
				
			||||||
#include <nano/node/testing.hpp>
 | 
					#include <nano/node/testing.hpp>
 | 
				
			||||||
| 
						 | 
					@ -5,11 +7,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gtest/gtest.h>
 | 
					#include <gtest/gtest.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
#include <boost/asio/connect.hpp>
 | 
					 | 
				
			||||||
#include <boost/asio/ip/tcp.hpp>
 | 
					 | 
				
			||||||
#include <boost/beast/core.hpp>
 | 
					 | 
				
			||||||
#include <boost/beast/websocket.hpp>
 | 
					 | 
				
			||||||
#include <boost/property_tree/json_parser.hpp>
 | 
					#include <boost/property_tree/json_parser.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <chrono>
 | 
					#include <chrono>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								nano/crypto/blake2/blake2.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								nano/crypto/blake2/blake2.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(push)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4804)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <crypto/blake2/blake2.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(pop)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										1
									
								
								nano/crypto/readme.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								nano/crypto/readme.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					These are files which wrap other crypto/ third party files and suppress compiler warnings associated with them.
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
 | 
					#include <nano/crypto/blake2/blake2.h>
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					#include <nano/crypto_lib/random_pool.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <crypto/blake2/blake2.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#include <crypto/ed25519-donna/ed25519-hash-custom.h>
 | 
					#include <crypto/ed25519-donna/ed25519-hash-custom.h>
 | 
				
			||||||
void ed25519_randombytes_unsafe (void * out, size_t outlen)
 | 
					void ed25519_randombytes_unsafe (void * out, size_t outlen)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,8 +20,6 @@ add_library (nano_lib
 | 
				
			||||||
	config.cpp
 | 
						config.cpp
 | 
				
			||||||
	errors.hpp
 | 
						errors.hpp
 | 
				
			||||||
	errors.cpp
 | 
						errors.cpp
 | 
				
			||||||
	interface.h
 | 
					 | 
				
			||||||
	interface.cpp
 | 
					 | 
				
			||||||
	ipc.hpp
 | 
						ipc.hpp
 | 
				
			||||||
	ipc.cpp
 | 
						ipc.cpp
 | 
				
			||||||
	ipc_client.hpp
 | 
						ipc_client.hpp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -185,7 +185,7 @@ std::error_code check_fields_set (uint8_t block_all_flags, uint8_t build_state)
 | 
				
			||||||
	if (res)
 | 
						if (res)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Convert the first bit set to a field mask and look up the error code.
 | 
							// Convert the first bit set to a field mask and look up the error code.
 | 
				
			||||||
		auto build_flags_mask = ffs_mask (res);
 | 
							auto build_flags_mask = static_cast<uint8_t> (ffs_mask (res));
 | 
				
			||||||
		assert (ec_map.find (build_flags_mask) != ec_map.end ());
 | 
							assert (ec_map.find (build_flags_mask) != ec_map.end ());
 | 
				
			||||||
		ec = ec_map[build_flags_mask];
 | 
							ec = ec_map[build_flags_mask];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,10 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/crypto/blake2/blake2.h>
 | 
				
			||||||
#include <nano/lib/errors.hpp>
 | 
					#include <nano/lib/errors.hpp>
 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					#include <nano/lib/numbers.hpp>
 | 
				
			||||||
#include <nano/lib/utility.hpp>
 | 
					#include <nano/lib/utility.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <crypto/blake2/blake2.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <boost/property_tree/json_parser.hpp>
 | 
					#include <boost/property_tree/json_parser.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <cassert>
 | 
					#include <cassert>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,139 +0,0 @@
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					 | 
				
			||||||
#include <nano/lib/blocks.hpp>
 | 
					 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					 | 
				
			||||||
#include <nano/lib/work.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <boost/property_tree/json_parser.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <cstring>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <crypto/ed25519-donna/ed25519.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern "C" {
 | 
					 | 
				
			||||||
void xrb_uint128_to_dec (xrb_uint128 source, char * destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto const & number (*reinterpret_cast<nano::uint128_union *> (source));
 | 
					 | 
				
			||||||
	strncpy (destination, number.to_string_dec ().c_str (), 40);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void xrb_uint256_to_string (xrb_uint256 source, char * destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto const & number (*reinterpret_cast<nano::uint256_union *> (source));
 | 
					 | 
				
			||||||
	strncpy (destination, number.to_string ().c_str (), 65);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void xrb_uint256_to_address (xrb_uint256 source, char * destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto const & number (*reinterpret_cast<nano::uint256_union *> (source));
 | 
					 | 
				
			||||||
	strncpy (destination, number.to_account ().c_str (), 65);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void xrb_uint512_to_string (xrb_uint512 source, char * destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto const & number (*reinterpret_cast<nano::uint512_union *> (source));
 | 
					 | 
				
			||||||
	strncpy (destination, number.to_string ().c_str (), 129);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int xrb_uint128_from_dec (const char * source, xrb_uint128 destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto & number (*reinterpret_cast<nano::uint128_union *> (destination));
 | 
					 | 
				
			||||||
	auto error (number.decode_dec (source));
 | 
					 | 
				
			||||||
	return error ? 1 : 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int xrb_uint256_from_string (const char * source, xrb_uint256 destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto & number (*reinterpret_cast<nano::uint256_union *> (destination));
 | 
					 | 
				
			||||||
	auto error (number.decode_hex (source));
 | 
					 | 
				
			||||||
	return error ? 1 : 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int xrb_uint512_from_string (const char * source, xrb_uint512 destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto & number (*reinterpret_cast<nano::uint512_union *> (destination));
 | 
					 | 
				
			||||||
	auto error (number.decode_hex (source));
 | 
					 | 
				
			||||||
	return error ? 1 : 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int xrb_valid_address (const char * account_a)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::uint256_union account;
 | 
					 | 
				
			||||||
	auto error (account.decode_account (account_a));
 | 
					 | 
				
			||||||
	return error ? 1 : 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void xrb_generate_random (xrb_uint256 seed)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto & number (*reinterpret_cast<nano::uint256_union *> (seed));
 | 
					 | 
				
			||||||
	nano::random_pool::generate_block (number.bytes.data (), number.bytes.size ());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void xrb_seed_key (xrb_uint256 seed, int index, xrb_uint256 destination)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto & seed_l (*reinterpret_cast<nano::uint256_union *> (seed));
 | 
					 | 
				
			||||||
	auto & destination_l (*reinterpret_cast<nano::uint256_union *> (destination));
 | 
					 | 
				
			||||||
	nano::deterministic_key (seed_l, index, destination_l);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void xrb_key_account (const xrb_uint256 key, xrb_uint256 pub)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	ed25519_publickey (key, pub);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
char * xrb_sign_transaction (const char * transaction, const xrb_uint256 private_key)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	char * result (nullptr);
 | 
					 | 
				
			||||||
	try
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		boost::property_tree::ptree block_l;
 | 
					 | 
				
			||||||
		std::string transaction_l (transaction);
 | 
					 | 
				
			||||||
		std::stringstream block_stream (transaction_l);
 | 
					 | 
				
			||||||
		boost::property_tree::read_json (block_stream, block_l);
 | 
					 | 
				
			||||||
		auto block (nano::deserialize_block_json (block_l));
 | 
					 | 
				
			||||||
		if (block != nullptr)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			nano::uint256_union pub;
 | 
					 | 
				
			||||||
			ed25519_publickey (private_key, pub.bytes.data ());
 | 
					 | 
				
			||||||
			nano::raw_key prv;
 | 
					 | 
				
			||||||
			prv.data = *reinterpret_cast<nano::uint256_union *> (private_key);
 | 
					 | 
				
			||||||
			block->signature_set (nano::sign_message (prv, pub, block->hash ()));
 | 
					 | 
				
			||||||
			auto json (block->to_json ());
 | 
					 | 
				
			||||||
			result = reinterpret_cast<char *> (malloc (json.size () + 1));
 | 
					 | 
				
			||||||
			strncpy (result, json.c_str (), json.size () + 1);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	catch (std::runtime_error const &)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return result;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
char * xrb_work_transaction (const char * transaction)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	static nano::network_constants network_constants;
 | 
					 | 
				
			||||||
	char * result (nullptr);
 | 
					 | 
				
			||||||
	try
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		boost::property_tree::ptree block_l;
 | 
					 | 
				
			||||||
		std::string transaction_l (transaction);
 | 
					 | 
				
			||||||
		std::stringstream block_stream (transaction_l);
 | 
					 | 
				
			||||||
		boost::property_tree::read_json (block_stream, block_l);
 | 
					 | 
				
			||||||
		auto block (nano::deserialize_block_json (block_l));
 | 
					 | 
				
			||||||
		if (block != nullptr)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			nano::work_pool pool (boost::thread::hardware_concurrency ());
 | 
					 | 
				
			||||||
			auto work (pool.generate (block->root (), network_constants.publish_threshold));
 | 
					 | 
				
			||||||
			block->block_work_set (work);
 | 
					 | 
				
			||||||
			auto json (block->to_json ());
 | 
					 | 
				
			||||||
			result = reinterpret_cast<char *> (malloc (json.size () + 1));
 | 
					 | 
				
			||||||
			strncpy (result, json.c_str (), json.size () + 1);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	catch (std::runtime_error const &)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return result;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,53 +0,0 @@
 | 
				
			||||||
#ifndef XRB_INTERFACE_H
 | 
					 | 
				
			||||||
#define XRB_INTERFACE_H
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if __cplusplus
 | 
					 | 
				
			||||||
extern "C" {
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef unsigned char * xrb_uint128; // 16byte array for public and private keys
 | 
					 | 
				
			||||||
typedef unsigned char * xrb_uint256; // 32byte array for public and private keys
 | 
					 | 
				
			||||||
typedef unsigned char * xrb_uint512; // 64byte array for signatures
 | 
					 | 
				
			||||||
typedef void * xrb_transaction;
 | 
					 | 
				
			||||||
// clang-format off
 | 
					 | 
				
			||||||
// Convert amount bytes 'source' to a 40 byte null-terminated decimal string 'destination'
 | 
					 | 
				
			||||||
[[deprecated]] void xrb_uint128_to_dec (const xrb_uint128 source, char * destination);
 | 
					 | 
				
			||||||
// Convert public/private key bytes 'source' to a 65 byte null-terminated hex string 'destination'
 | 
					 | 
				
			||||||
[[deprecated]] void xrb_uint256_to_string (const xrb_uint256 source, char * destination);
 | 
					 | 
				
			||||||
// Convert public key bytes 'source' to a 66 byte non-null-terminated account string 'destination'
 | 
					 | 
				
			||||||
[[deprecated]] void xrb_uint256_to_address (xrb_uint256 source, char * destination);
 | 
					 | 
				
			||||||
// Convert public/private key bytes 'source' to a 129 byte null-terminated hex string 'destination'
 | 
					 | 
				
			||||||
[[deprecated]] void xrb_uint512_to_string (const xrb_uint512 source, char * destination);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Convert 39 byte decimal string 'source' to a byte array 'destination'
 | 
					 | 
				
			||||||
// Return 0 on success, nonzero on error
 | 
					 | 
				
			||||||
[[deprecated]] int xrb_uint128_from_dec (const char * source, xrb_uint128 destination);
 | 
					 | 
				
			||||||
// Convert 64 byte hex string 'source' to a byte array 'destination'
 | 
					 | 
				
			||||||
// Return 0 on success, nonzero on error
 | 
					 | 
				
			||||||
[[deprecated]] int xrb_uint256_from_string (const char * source, xrb_uint256 destination);
 | 
					 | 
				
			||||||
// Convert 128 byte hex string 'source' to a byte array 'destination'
 | 
					 | 
				
			||||||
// Return 0 on success, nonzero on error
 | 
					 | 
				
			||||||
[[deprecated]] int xrb_uint512_from_string (const char * source, xrb_uint512 destination);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Check if the null-terminated string 'account' is a valid xrb account number
 | 
					 | 
				
			||||||
// Return 0 on correct, nonzero on invalid
 | 
					 | 
				
			||||||
[[deprecated]] int xrb_valid_address (const char * account);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Create a new random number in to 'destination'
 | 
					 | 
				
			||||||
[[deprecated]] void xrb_generate_random (xrb_uint256 destination);
 | 
					 | 
				
			||||||
// Retrieve the deterministic private key for 'seed' at 'index'
 | 
					 | 
				
			||||||
[[deprecated]] void xrb_seed_key (const xrb_uint256 seed, int index, xrb_uint256);
 | 
					 | 
				
			||||||
// Derive the public key 'pub' from 'key'
 | 
					 | 
				
			||||||
[[deprecated]] void xrb_key_account (xrb_uint256 key, xrb_uint256 pub);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Sign 'transaction' using 'private_key' and write to 'signature'
 | 
					 | 
				
			||||||
char * xrb_sign_transaction (const char * transaction, const xrb_uint256 private_key);
 | 
					 | 
				
			||||||
// Generate work for 'transaction'
 | 
					 | 
				
			||||||
[[deprecated]]
 | 
					 | 
				
			||||||
char * xrb_work_transaction (const char * transaction);
 | 
					 | 
				
			||||||
// clang-format on
 | 
					 | 
				
			||||||
#if __cplusplus
 | 
					 | 
				
			||||||
} // extern "C"
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // XRB_INTERFACE_H
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/property_tree/ptree.hpp>
 | 
					#include <boost/property_tree/ptree.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <atomic>
 | 
					#include <atomic>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/errors.hpp>
 | 
					#include <nano/lib/errors.hpp>
 | 
				
			||||||
#include <nano/lib/ipc.hpp>
 | 
					#include <nano/lib/ipc.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
#include <boost/property_tree/ptree.hpp>
 | 
					#include <boost/property_tree/ptree.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <atomic>
 | 
					#include <atomic>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/errors.hpp>
 | 
					#include <nano/lib/errors.hpp>
 | 
				
			||||||
#include <nano/lib/utility.hpp>
 | 
					#include <nano/lib/utility.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
#include <boost/filesystem.hpp>
 | 
					#include <boost/filesystem.hpp>
 | 
				
			||||||
#include <boost/lexical_cast.hpp>
 | 
					#include <boost/lexical_cast.hpp>
 | 
				
			||||||
#include <boost/optional.hpp>
 | 
					#include <boost/optional.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
 | 
					#include <nano/crypto/blake2/blake2.h>
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					#include <nano/crypto_lib/random_pool.hpp>
 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					#include <nano/lib/numbers.hpp>
 | 
				
			||||||
#include <nano/lib/utility.hpp>
 | 
					#include <nano/lib/utility.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <crypto/blake2/blake2.h>
 | 
					 | 
				
			||||||
#include <crypto/cryptopp/aes.h>
 | 
					#include <crypto/cryptopp/aes.h>
 | 
				
			||||||
#include <crypto/cryptopp/modes.h>
 | 
					#include <crypto/cryptopp/modes.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -817,6 +817,11 @@ std::string nano::to_string (double const value_a, int const precision_a)
 | 
				
			||||||
	return stream.str ();
 | 
						return stream.str ();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(push)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4146) // warning C4146: unary minus operator applied to unsigned type, result still unsigned
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint64_t nano::difficulty::from_multiplier (double const multiplier_a, uint64_t const base_difficulty_a)
 | 
					uint64_t nano::difficulty::from_multiplier (double const multiplier_a, uint64_t const base_difficulty_a)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	assert (multiplier_a > 0.);
 | 
						assert (multiplier_a > 0.);
 | 
				
			||||||
| 
						 | 
					@ -828,3 +833,7 @@ double nano::difficulty::to_multiplier (uint64_t const difficulty_a, uint64_t co
 | 
				
			||||||
	assert (difficulty_a > 0);
 | 
						assert (difficulty_a > 0);
 | 
				
			||||||
	return static_cast<double> (-base_difficulty_a) / (-difficulty_a);
 | 
						return static_cast<double> (-base_difficulty_a) / (-difficulty_a);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning(pop)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
#include <nano/lib/errors.hpp>
 | 
					#include <nano/lib/errors.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
#include <boost/filesystem.hpp>
 | 
					#include <boost/filesystem.hpp>
 | 
				
			||||||
#include <boost/thread.hpp>
 | 
					#include <boost/thread.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ public:
 | 
				
			||||||
	rpc_secure_config secure;
 | 
						rpc_secure_config secure;
 | 
				
			||||||
	uint8_t max_json_depth{ 20 };
 | 
						uint8_t max_json_depth{ 20 };
 | 
				
			||||||
	uint64_t max_request_size{ 32 * 1024 * 1024 };
 | 
						uint64_t max_request_size{ 32 * 1024 * 1024 };
 | 
				
			||||||
	static int json_version ()
 | 
						static unsigned json_version ()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/stats.hpp>
 | 
					#include <nano/lib/stats.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
#include <boost/format.hpp>
 | 
					#include <boost/format.hpp>
 | 
				
			||||||
#include <boost/property_tree/json_parser.hpp>
 | 
					#include <boost/property_tree/json_parser.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/filesystem.hpp>
 | 
					#include <boost/filesystem.hpp>
 | 
				
			||||||
#include <boost/system/error_code.hpp>
 | 
					#include <boost/system/error_code.hpp>
 | 
				
			||||||
#include <boost/thread/thread.hpp>
 | 
					#include <boost/thread/thread.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,13 +1,11 @@
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
 | 
					#include <nano/boost/beast.hpp>
 | 
				
			||||||
 | 
					#include <nano/boost/process.hpp>
 | 
				
			||||||
#include <nano/core_test/testutil.hpp>
 | 
					#include <nano/core_test/testutil.hpp>
 | 
				
			||||||
#include <nano/node/daemonconfig.hpp>
 | 
					#include <nano/node/daemonconfig.hpp>
 | 
				
			||||||
#include <nano/node/testing.hpp>
 | 
					#include <nano/node/testing.hpp>
 | 
				
			||||||
#include <nano/secure/utility.hpp>
 | 
					#include <nano/secure/utility.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio/connect.hpp>
 | 
					 | 
				
			||||||
#include <boost/asio/ip/tcp.hpp>
 | 
					 | 
				
			||||||
#include <boost/beast/core.hpp>
 | 
					 | 
				
			||||||
#include <boost/beast/http.hpp>
 | 
					 | 
				
			||||||
#include <boost/beast/version.hpp>
 | 
					 | 
				
			||||||
#include <boost/dll/runtime_symbol_info.hpp>
 | 
					#include <boost/dll/runtime_symbol_info.hpp>
 | 
				
			||||||
#include <boost/program_options.hpp>
 | 
					#include <boost/program_options.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,14 +30,6 @@ namespace http = beast::http;
 | 
				
			||||||
namespace net = boost::asio;
 | 
					namespace net = boost::asio;
 | 
				
			||||||
using tcp = net::ip::tcp;
 | 
					using tcp = net::ip::tcp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef BOOST_PROCESS_SUPPORTED
 | 
					 | 
				
			||||||
#error BOOST_PROCESS_SUPPORTED must be set, check configuration
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if BOOST_PROCESS_SUPPORTED
 | 
					 | 
				
			||||||
#include <boost/process.hpp>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
constexpr auto rpc_port_start = 60000;
 | 
					constexpr auto rpc_port_start = 60000;
 | 
				
			||||||
constexpr auto peering_port_start = 61000;
 | 
					constexpr auto peering_port_start = 61000;
 | 
				
			||||||
constexpr auto ipc_port_start = 62000;
 | 
					constexpr auto ipc_port_start = 62000;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
 | 
					#include <nano/boost/process.hpp>
 | 
				
			||||||
#include <nano/lib/utility.hpp>
 | 
					#include <nano/lib/utility.hpp>
 | 
				
			||||||
#include <nano/nano_node/daemon.hpp>
 | 
					#include <nano/nano_node/daemon.hpp>
 | 
				
			||||||
#include <nano/node/daemonconfig.hpp>
 | 
					#include <nano/node/daemonconfig.hpp>
 | 
				
			||||||
| 
						 | 
					@ -14,14 +15,6 @@
 | 
				
			||||||
#include <fstream>
 | 
					#include <fstream>
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef BOOST_PROCESS_SUPPORTED
 | 
					 | 
				
			||||||
#error BOOST_PROCESS_SUPPORTED must be set, check configuration
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if BOOST_PROCESS_SUPPORTED
 | 
					 | 
				
			||||||
#include <boost/process.hpp>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace
 | 
					namespace
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
void my_abort_signal_handler (int signum)
 | 
					void my_abort_signal_handler (int signum)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
 | 
					#include <nano/boost/process.hpp>
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					#include <nano/crypto_lib/random_pool.hpp>
 | 
				
			||||||
#include <nano/lib/errors.hpp>
 | 
					#include <nano/lib/errors.hpp>
 | 
				
			||||||
#include <nano/lib/jsonconfig.hpp>
 | 
					#include <nano/lib/jsonconfig.hpp>
 | 
				
			||||||
| 
						 | 
					@ -17,14 +18,6 @@
 | 
				
			||||||
#include <boost/property_tree/json_parser.hpp>
 | 
					#include <boost/property_tree/json_parser.hpp>
 | 
				
			||||||
#include <boost/property_tree/ptree.hpp>
 | 
					#include <boost/property_tree/ptree.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef BOOST_PROCESS_SUPPORTED
 | 
					 | 
				
			||||||
#error BOOST_PROCESS_SUPPORTED must be set, check configuration
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if BOOST_PROCESS_SUPPORTED
 | 
					 | 
				
			||||||
#include <boost/process.hpp>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class qt_wallet_config
 | 
					class qt_wallet_config
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
| 
						 | 
					@ -180,7 +173,7 @@ public:
 | 
				
			||||||
	bool opencl_enable{ false };
 | 
						bool opencl_enable{ false };
 | 
				
			||||||
	nano::opencl_config opencl;
 | 
						nano::opencl_config opencl;
 | 
				
			||||||
	boost::filesystem::path data_path;
 | 
						boost::filesystem::path data_path;
 | 
				
			||||||
	int json_version () const
 | 
						unsigned json_version () const
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return 4;
 | 
							return 4;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -599,7 +599,7 @@ void nano::active_transactions::adjust_difficulty (nano::block_hash const & hash
 | 
				
			||||||
		// Possible overflow check, will not occur for negative levels
 | 
							// Possible overflow check, will not occur for negative levels
 | 
				
			||||||
		if ((multiplier + highest_level) > 10000000000)
 | 
							if ((multiplier + highest_level) > 10000000000)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			divider = ((multiplier + highest_level) / 10000000000) + 1;
 | 
								divider = static_cast<uint64_t> (((multiplier + highest_level) / 10000000000) + 1);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Set adjusted difficulty
 | 
							// Set adjusted difficulty
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1293,7 +1293,8 @@ void nano::bootstrap_attempt::lazy_pull_flush ()
 | 
				
			||||||
		// Recheck if block was already processed
 | 
							// Recheck if block was already processed
 | 
				
			||||||
		if (lazy_blocks.find (pull_start) == lazy_blocks.end () && !node->store.block_exists (transaction, pull_start))
 | 
							if (lazy_blocks.find (pull_start) == lazy_blocks.end () && !node->store.block_exists (transaction, pull_start))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			pulls.push_back (nano::pull_info (pull_start, pull_start, nano::block_hash (0), node->network_params.bootstrap.lazy_max_pull_blocks));
 | 
								assert (node->network_params.bootstrap.lazy_max_pull_blocks <= std::numeric_limits<nano::pull_info::count_t>::max ());
 | 
				
			||||||
 | 
								pulls.push_back (nano::pull_info (pull_start, pull_start, nano::block_hash (0), static_cast<nano::pull_info::count_t> (node->network_params.bootstrap.lazy_max_pull_blocks)));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	lazy_pulls.clear ();
 | 
						lazy_pulls.clear ();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/node/cli.hpp>
 | 
					#include <nano/node/cli.hpp>
 | 
				
			||||||
#include <nano/node/common.hpp>
 | 
					#include <nano/node/common.hpp>
 | 
				
			||||||
#include <nano/node/daemonconfig.hpp>
 | 
					#include <nano/node/daemonconfig.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,7 +90,7 @@ void nano::message_header::block_type_set (nano::block_type type_a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t nano::message_header::count_get () const
 | 
					uint8_t nano::message_header::count_get () const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return ((extensions & count_mask) >> 12).to_ullong ();
 | 
						return static_cast<uint8_t> (((extensions & count_mask) >> 12).to_ullong ());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void nano::message_header::count_set (uint8_t count_a)
 | 
					void nano::message_header::count_set (uint8_t count_a)
 | 
				
			||||||
| 
						 | 
					@ -561,7 +561,7 @@ roots_hashes (roots_hashes_a)
 | 
				
			||||||
	// not_a_block (1) block type for hashes + roots request
 | 
						// not_a_block (1) block type for hashes + roots request
 | 
				
			||||||
	header.block_type_set (nano::block_type::not_a_block);
 | 
						header.block_type_set (nano::block_type::not_a_block);
 | 
				
			||||||
	assert (roots_hashes.size () < 16);
 | 
						assert (roots_hashes.size () < 16);
 | 
				
			||||||
	header.count_set (roots_hashes.size ());
 | 
						header.count_set (static_cast<uint8_t> (roots_hashes.size ()));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
nano::confirm_req::confirm_req (nano::block_hash const & hash_a, nano::block_hash const & root_a) :
 | 
					nano::confirm_req::confirm_req (nano::block_hash const & hash_a, nano::block_hash const & root_a) :
 | 
				
			||||||
| 
						 | 
					@ -571,7 +571,8 @@ roots_hashes (std::vector<std::pair<nano::block_hash, nano::block_hash>> (1, std
 | 
				
			||||||
	assert (!roots_hashes.empty ());
 | 
						assert (!roots_hashes.empty ());
 | 
				
			||||||
	// not_a_block (1) block type for hashes + roots request
 | 
						// not_a_block (1) block type for hashes + roots request
 | 
				
			||||||
	header.block_type_set (nano::block_type::not_a_block);
 | 
						header.block_type_set (nano::block_type::not_a_block);
 | 
				
			||||||
	header.count_set (roots_hashes.size ());
 | 
						assert (roots_hashes.size () < 16);
 | 
				
			||||||
 | 
						header.count_set (static_cast<uint8_t> (roots_hashes.size ()));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void nano::confirm_req::visit (nano::message_visitor & visitor_a) const
 | 
					void nano::confirm_req::visit (nano::message_visitor & visitor_a) const
 | 
				
			||||||
| 
						 | 
					@ -700,7 +701,7 @@ vote (vote_a)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		header.block_type_set (nano::block_type::not_a_block);
 | 
							header.block_type_set (nano::block_type::not_a_block);
 | 
				
			||||||
		assert (vote_a->blocks.size () < 16);
 | 
							assert (vote_a->blocks.size () < 16);
 | 
				
			||||||
		header.count_set (vote_a->blocks.size ());
 | 
							header.count_set (static_cast<uint8_t> (vote_a->blocks.size ()));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,13 +1,11 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					#include <nano/crypto_lib/random_pool.hpp>
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/lib/memory.hpp>
 | 
					#include <nano/lib/memory.hpp>
 | 
				
			||||||
#include <nano/secure/common.hpp>
 | 
					#include <nano/secure/common.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <bitset>
 | 
					#include <bitset>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nano
 | 
					namespace nano
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ public:
 | 
				
			||||||
	bool opencl_enable{ false };
 | 
						bool opencl_enable{ false };
 | 
				
			||||||
	nano::opencl_config opencl;
 | 
						nano::opencl_config opencl;
 | 
				
			||||||
	boost::filesystem::path data_path;
 | 
						boost::filesystem::path data_path;
 | 
				
			||||||
	int json_version () const
 | 
						unsigned json_version () const
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return 2;
 | 
							return 2;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -237,7 +237,7 @@ public:
 | 
				
			||||||
		// A separate io_context for domain sockets may facilitate better performance on some systems.
 | 
							// A separate io_context for domain sockets may facilitate better performance on some systems.
 | 
				
			||||||
		if (concurrency_a > 0)
 | 
							if (concurrency_a > 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			runner = std::make_unique<nano::thread_runner> (*io_ctx, concurrency_a);
 | 
								runner = std::make_unique<nano::thread_runner> (*io_ctx, static_cast<unsigned> (concurrency_a));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -304,7 +304,7 @@ node_rpc_config (node_rpc_config_a)
 | 
				
			||||||
		if (node_a.config.ipc_config.transport_domain.enabled)
 | 
							if (node_a.config.ipc_config.transport_domain.enabled)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
 | 
					#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
 | 
				
			||||||
			size_t threads = node_a.config.ipc_config.transport_domain.io_threads;
 | 
								auto threads = node_a.config.ipc_config.transport_domain.io_threads;
 | 
				
			||||||
			file_remover = std::make_unique<dsock_file_remover> (node_a.config.ipc_config.transport_domain.path);
 | 
								file_remover = std::make_unique<dsock_file_remover> (node_a.config.ipc_config.transport_domain.path);
 | 
				
			||||||
			boost::asio::local::stream_protocol::endpoint ep{ node_a.config.ipc_config.transport_domain.path };
 | 
								boost::asio::local::stream_protocol::endpoint ep{ node_a.config.ipc_config.transport_domain.path };
 | 
				
			||||||
			transports.push_back (std::make_shared<socket_transport<boost::asio::local::stream_protocol::acceptor, boost::asio::local::stream_protocol::socket, boost::asio::local::stream_protocol::endpoint>> (*this, ep, node_a.config.ipc_config.transport_domain, threads));
 | 
								transports.push_back (std::make_shared<socket_transport<boost::asio::local::stream_protocol::acceptor, boost::asio::local::stream_protocol::socket, boost::asio::local::stream_protocol::endpoint>> (*this, ep, node_a.config.ipc_config.transport_domain, threads));
 | 
				
			||||||
| 
						 | 
					@ -315,7 +315,7 @@ node_rpc_config (node_rpc_config_a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (node_a.config.ipc_config.transport_tcp.enabled)
 | 
							if (node_a.config.ipc_config.transport_tcp.enabled)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			size_t threads = node_a.config.ipc_config.transport_tcp.io_threads;
 | 
								auto threads = node_a.config.ipc_config.transport_tcp.io_threads;
 | 
				
			||||||
			transports.push_back (std::make_shared<socket_transport<boost::asio::ip::tcp::acceptor, boost::asio::ip::tcp::socket, boost::asio::ip::tcp::endpoint>> (*this, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v6 (), node_a.config.ipc_config.transport_tcp.port), node_a.config.ipc_config.transport_tcp, threads));
 | 
								transports.push_back (std::make_shared<socket_transport<boost::asio::ip::tcp::acceptor, boost::asio::ip::tcp::socket, boost::asio::ip::tcp::endpoint>> (*this, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v6 (), node_a.config.ipc_config.transport_tcp.port), node_a.config.ipc_config.transport_tcp, threads));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ namespace ipc
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		std::string path{ "/tmp/nano" };
 | 
							std::string path{ "/tmp/nano" };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int json_version () const
 | 
							unsigned json_version () const
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ public:
 | 
				
			||||||
	uintmax_t rotation_size{ 4 * 1024 * 1024 };
 | 
						uintmax_t rotation_size{ 4 * 1024 * 1024 };
 | 
				
			||||||
	std::chrono::milliseconds min_time_between_log_output{ 5 };
 | 
						std::chrono::milliseconds min_time_between_log_output{ 5 };
 | 
				
			||||||
	static void release_file_sink ();
 | 
						static void release_file_sink ();
 | 
				
			||||||
	int json_version () const
 | 
						unsigned json_version () const
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return 7;
 | 
							return 7;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/node/common.hpp>
 | 
					#include <nano/node/common.hpp>
 | 
				
			||||||
#include <nano/node/transport/tcp.hpp>
 | 
					#include <nano/node/transport/tcp.hpp>
 | 
				
			||||||
#include <nano/node/transport/udp.hpp>
 | 
					#include <nano/node/transport/udp.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio/thread_pool.hpp>
 | 
					 | 
				
			||||||
#include <boost/thread/thread.hpp>
 | 
					#include <boost/thread/thread.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <memory>
 | 
					#include <memory>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					#include <nano/crypto_lib/random_pool.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/lib/timer.hpp>
 | 
					#include <nano/lib/timer.hpp>
 | 
				
			||||||
#include <nano/lib/utility.hpp>
 | 
					#include <nano/lib/utility.hpp>
 | 
				
			||||||
#include <nano/node/common.hpp>
 | 
					#include <nano/node/common.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/stats.hpp>
 | 
					#include <nano/lib/stats.hpp>
 | 
				
			||||||
#include <nano/lib/work.hpp>
 | 
					#include <nano/lib/work.hpp>
 | 
				
			||||||
#include <nano/node/active_transactions.hpp>
 | 
					#include <nano/node/active_transactions.hpp>
 | 
				
			||||||
| 
						 | 
					@ -23,7 +24,6 @@
 | 
				
			||||||
#include <nano/node/write_database_queue.hpp>
 | 
					#include <nano/node/write_database_queue.hpp>
 | 
				
			||||||
#include <nano/secure/ledger.hpp>
 | 
					#include <nano/secure/ledger.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio/thread_pool.hpp>
 | 
					 | 
				
			||||||
#include <boost/iostreams/device/array.hpp>
 | 
					#include <boost/iostreams/device/array.hpp>
 | 
				
			||||||
#include <boost/multi_index/hashed_index.hpp>
 | 
					#include <boost/multi_index/hashed_index.hpp>
 | 
				
			||||||
#include <boost/multi_index/member.hpp>
 | 
					#include <boost/multi_index/member.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@ public:
 | 
				
			||||||
	bool enable_sign_hash{ false };
 | 
						bool enable_sign_hash{ false };
 | 
				
			||||||
	uint64_t max_work_generate_difficulty{ 0xffffffffc0000000 };
 | 
						uint64_t max_work_generate_difficulty{ 0xffffffffc0000000 };
 | 
				
			||||||
	nano::rpc_child_process_config child_process;
 | 
						nano::rpc_child_process_config child_process;
 | 
				
			||||||
	static int json_version ()
 | 
						static unsigned json_version ()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -351,8 +351,8 @@ nano::error nano::node_config::deserialize_json (bool & upgraded_a, nano::jsonco
 | 
				
			||||||
			json.get_error ().set ("vote_minimum contains an invalid decimal amount");
 | 
								json.get_error ().set ("vote_minimum contains an invalid decimal amount");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		unsigned long delay_l = vote_generator_delay.count ();
 | 
							auto delay_l = vote_generator_delay.count ();
 | 
				
			||||||
		json.get<unsigned long> ("vote_generator_delay", delay_l);
 | 
							json.get ("vote_generator_delay", delay_l);
 | 
				
			||||||
		vote_generator_delay = std::chrono::milliseconds (delay_l);
 | 
							vote_generator_delay = std::chrono::milliseconds (delay_l);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		json.get<unsigned> ("vote_generator_threshold", vote_generator_threshold);
 | 
							json.get<unsigned> ("vote_generator_threshold", vote_generator_threshold);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,7 +77,7 @@ public:
 | 
				
			||||||
	static std::chrono::minutes constexpr wallet_backup_interval = std::chrono::minutes (5);
 | 
						static std::chrono::minutes constexpr wallet_backup_interval = std::chrono::minutes (5);
 | 
				
			||||||
	size_t bandwidth_limit{ 5 * 1024 * 1024 }; // 5Mb/s
 | 
						size_t bandwidth_limit{ 5 * 1024 * 1024 }; // 5Mb/s
 | 
				
			||||||
	std::chrono::milliseconds conf_height_processor_batch_min_time{ 50 };
 | 
						std::chrono::milliseconds conf_height_processor_batch_min_time{ 50 };
 | 
				
			||||||
	static int json_version ()
 | 
						static unsigned json_version ()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return 17;
 | 
							return 17;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,7 +82,7 @@ void nano::port_mapping::refresh_mapping ()
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (add_port_mapping_error == UPNPCOMMAND_SUCCESS)
 | 
								if (add_port_mapping_error == UPNPCOMMAND_SUCCESS)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				protocol.external_port = std::atoi (actual_external_port.data ());
 | 
									protocol.external_port = static_cast<uint16_t> (std::atoi (actual_external_port.data ()));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,13 +1,12 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio/ip/address_v4.hpp>
 | 
					#include <miniupnp/miniupnpc/miniupnpc.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <mutex>
 | 
					#include <mutex>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <miniupnp/miniupnpc/miniupnpc.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace nano
 | 
					namespace nano
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
class node;
 | 
					class node;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/node/common.hpp>
 | 
					#include <nano/node/common.hpp>
 | 
				
			||||||
#include <nano/node/transport/transport.hpp>
 | 
					#include <nano/node/transport/transport.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
#include <boost/multi_index/hashed_index.hpp>
 | 
					#include <boost/multi_index/hashed_index.hpp>
 | 
				
			||||||
#include <boost/multi_index/mem_fun.hpp>
 | 
					#include <boost/multi_index/mem_fun.hpp>
 | 
				
			||||||
#include <boost/multi_index/member.hpp>
 | 
					#include <boost/multi_index/member.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,8 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/utility.hpp>
 | 
					#include <nano/lib/utility.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <atomic>
 | 
					#include <atomic>
 | 
				
			||||||
#include <future>
 | 
					#include <future>
 | 
				
			||||||
#include <mutex>
 | 
					#include <mutex>
 | 
				
			||||||
| 
						 | 
					@ -39,7 +38,7 @@ public:
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	struct Task final
 | 
						struct Task final
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Task (nano::signature_check_set & check, int pending) :
 | 
							Task (nano::signature_check_set & check, size_t pending) :
 | 
				
			||||||
		check (check), pending (pending)
 | 
							check (check), pending (pending)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -48,7 +47,7 @@ private:
 | 
				
			||||||
			release_assert (pending == 0);
 | 
								release_assert (pending == 0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		nano::signature_check_set & check;
 | 
							nano::signature_check_set & check;
 | 
				
			||||||
		std::atomic<int> pending;
 | 
							std::atomic<size_t> pending;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool verify_batch (const nano::signature_check_set & check_a, size_t index, size_t size);
 | 
						bool verify_batch (const nano::signature_check_set & check_a, size_t index, size_t size);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/optional.hpp>
 | 
					#include <boost/optional.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <chrono>
 | 
					#include <chrono>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/node/common.hpp>
 | 
					#include <nano/node/common.hpp>
 | 
				
			||||||
#include <nano/node/transport/transport.hpp>
 | 
					#include <nano/node/transport/transport.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio/buffer.hpp>
 | 
					 | 
				
			||||||
#include <boost/multi_index/hashed_index.hpp>
 | 
					#include <boost/multi_index/hashed_index.hpp>
 | 
				
			||||||
#include <boost/multi_index/mem_fun.hpp>
 | 
					#include <boost/multi_index/mem_fun.hpp>
 | 
				
			||||||
#include <boost/multi_index/member.hpp>
 | 
					#include <boost/multi_index/member.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -235,7 +235,7 @@ bool nano::bandwidth_limiter::should_drop (const size_t & message_size)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		next_trend = std::chrono::steady_clock::now () + 50ms;
 | 
							next_trend = std::chrono::steady_clock::now () + 50ms;
 | 
				
			||||||
		rate_buffer.push_back (rate);
 | 
							rate_buffer.push_back (rate);
 | 
				
			||||||
		trended_rate = std::accumulate (rate_buffer.begin (), rate_buffer.end (), 0) / rate_buffer.size ();
 | 
							trended_rate = std::accumulate (rate_buffer.begin (), rate_buffer.end (), size_t{ 0 }) / rate_buffer.size ();
 | 
				
			||||||
		rate = 0;
 | 
							rate = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return result;
 | 
						return result;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/node/common.hpp>
 | 
					#include <nano/node/common.hpp>
 | 
				
			||||||
#include <nano/node/transport/transport.hpp>
 | 
					#include <nano/node/transport/transport.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio/buffer.hpp>
 | 
					 | 
				
			||||||
#include <boost/multi_index/hashed_index.hpp>
 | 
					#include <boost/multi_index/hashed_index.hpp>
 | 
				
			||||||
#include <boost/multi_index/mem_fun.hpp>
 | 
					#include <boost/multi_index/mem_fun.hpp>
 | 
				
			||||||
#include <boost/multi_index/member.hpp>
 | 
					#include <boost/multi_index/member.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,14 +1,10 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
 | 
					#include <nano/boost/beast.hpp>
 | 
				
			||||||
#include <nano/lib/blocks.hpp>
 | 
					#include <nano/lib/blocks.hpp>
 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					#include <nano/lib/numbers.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio/bind_executor.hpp>
 | 
					 | 
				
			||||||
#include <boost/asio/buffer.hpp>
 | 
					 | 
				
			||||||
#include <boost/asio/ip/tcp.hpp>
 | 
					 | 
				
			||||||
#include <boost/asio/strand.hpp>
 | 
					 | 
				
			||||||
#include <boost/beast/core.hpp>
 | 
					 | 
				
			||||||
#include <boost/beast/websocket.hpp>
 | 
					 | 
				
			||||||
#include <boost/property_tree/json_parser.hpp>
 | 
					#include <boost/property_tree/json_parser.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <algorithm>
 | 
					#include <algorithm>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
#include <nano/lib/errors.hpp>
 | 
					#include <nano/lib/errors.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace nano
 | 
					namespace nano
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
class jsonconfig;
 | 
					class jsonconfig;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ int main (int argc, char ** argv)
 | 
				
			||||||
	QCoreApplication::setOrganizationDomain ("nano.org");
 | 
						QCoreApplication::setOrganizationDomain ("nano.org");
 | 
				
			||||||
	QCoreApplication::setApplicationName ("Nano Wallet");
 | 
						QCoreApplication::setApplicationName ("Nano Wallet");
 | 
				
			||||||
	nano_qt::eventloop_processor processor;
 | 
						nano_qt::eventloop_processor processor;
 | 
				
			||||||
	static int count (16);
 | 
						static uint16_t count (16);
 | 
				
			||||||
	nano::system system (24000, count);
 | 
						nano::system system (24000, count);
 | 
				
			||||||
	nano::thread_runner runner (system.io_ctx, system.nodes[0]->config.io_threads);
 | 
						nano::thread_runner runner (system.io_ctx, system.nodes[0]->config.io_threads);
 | 
				
			||||||
	std::unique_ptr<QTabWidget> client_tabs (new QTabWidget);
 | 
						std::unique_ptr<QTabWidget> client_tabs (new QTabWidget);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								nano/qt_test/QTest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								nano/qt_test/QTest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning (push)
 | 
				
			||||||
 | 
					#pragma warning (disable : 4242) // warning C4242: 'argument': conversion from 'int' to 'ushort', possible loss of data
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QTest>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#pragma warning (pop)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					@ -6,8 +6,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/property_tree/json_parser.hpp>
 | 
					#include <boost/property_tree/json_parser.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QTest>
 | 
					 | 
				
			||||||
#include <algorithm>
 | 
					#include <algorithm>
 | 
				
			||||||
 | 
					#include <nano/qt_test/QTest>
 | 
				
			||||||
#include <thread>
 | 
					#include <thread>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace std::chrono_literals;
 | 
					using namespace std::chrono_literals;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,10 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/boost/asio.hpp>
 | 
				
			||||||
#include <nano/lib/logger_mt.hpp>
 | 
					#include <nano/lib/logger_mt.hpp>
 | 
				
			||||||
#include <nano/lib/rpc_handler_interface.hpp>
 | 
					#include <nano/lib/rpc_handler_interface.hpp>
 | 
				
			||||||
#include <nano/lib/rpcconfig.hpp>
 | 
					#include <nano/lib/rpcconfig.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <boost/asio.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace nano
 | 
					namespace nano
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
class rpc_handler_interface;
 | 
					class rpc_handler_interface;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -895,7 +895,7 @@ public:
 | 
				
			||||||
		auto version (block_version (transaction_a, hash_a));
 | 
							auto version (block_version (transaction_a, hash_a));
 | 
				
			||||||
		assert (value.size () != 0);
 | 
							assert (value.size () != 0);
 | 
				
			||||||
		std::vector<uint8_t> data (static_cast<uint8_t *> (value.data ()), static_cast<uint8_t *> (value.data ()) + value.size ());
 | 
							std::vector<uint8_t> data (static_cast<uint8_t *> (value.data ()), static_cast<uint8_t *> (value.data ()) + value.size ());
 | 
				
			||||||
		std::fill_n (data.begin () + block_successor_offset (transaction_a, value.size (), type), sizeof (nano::uint256_union), 0);
 | 
							std::fill_n (data.begin () + block_successor_offset (transaction_a, value.size (), type), sizeof (nano::uint256_union), uint8_t{ 0 });
 | 
				
			||||||
		block_raw_put (transaction_a, data, type, version, hash_a);
 | 
							block_raw_put (transaction_a, data, type, version, hash_a);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
#include <nano/core_test/testutil.hpp>
 | 
					#include <nano/core_test/testutil.hpp>
 | 
				
			||||||
#include <nano/crypto_lib/random_pool.hpp>
 | 
					#include <nano/crypto_lib/random_pool.hpp>
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					#include <nano/lib/numbers.hpp>
 | 
				
			||||||
#include <nano/secure/blockstore.hpp>
 | 
					#include <nano/secure/blockstore.hpp>
 | 
				
			||||||
#include <nano/secure/common.hpp>
 | 
					#include <nano/secure/common.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nano/crypto/blake2/blake2.h>
 | 
				
			||||||
#include <nano/lib/blockbuilders.hpp>
 | 
					#include <nano/lib/blockbuilders.hpp>
 | 
				
			||||||
#include <nano/lib/blocks.hpp>
 | 
					#include <nano/lib/blocks.hpp>
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
| 
						 | 
					@ -7,8 +8,6 @@
 | 
				
			||||||
#include <nano/lib/utility.hpp>
 | 
					#include <nano/lib/utility.hpp>
 | 
				
			||||||
#include <nano/secure/utility.hpp>
 | 
					#include <nano/secure/utility.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <crypto/blake2/blake2.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <boost/iterator/transform_iterator.hpp>
 | 
					#include <boost/iterator/transform_iterator.hpp>
 | 
				
			||||||
#include <boost/property_tree/ptree.hpp>
 | 
					#include <boost/property_tree/ptree.hpp>
 | 
				
			||||||
#include <boost/variant.hpp>
 | 
					#include <boost/variant.hpp>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
#include <nano/lib/config.hpp>
 | 
					#include <nano/lib/config.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/secure/utility.hpp>
 | 
					#include <nano/secure/utility.hpp>
 | 
				
			||||||
#include <nano/secure/working.hpp>
 | 
					#include <nano/secure/working.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <nano/lib/errors.hpp>
 | 
					#include <nano/lib/errors.hpp>
 | 
				
			||||||
#include <nano/lib/interface.h>
 | 
					 | 
				
			||||||
#include <nano/lib/numbers.hpp>
 | 
					#include <nano/lib/numbers.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <crypto/cryptopp/osrng.h>
 | 
					#include <crypto/cryptopp/osrng.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue