Remove confirmation_height_currently_processing RPC as it's only for debugging and make the process of confirming more complicated.
This commit is contained in:
		
					parent
					
						
							
								27cb6749be
							
						
					
				
			
			
				commit
				
					
						ab995e4ec6
					
				
			
		
					 4 changed files with 0 additions and 83 deletions
				
			
		| 
						 | 
					@ -2002,20 +2002,6 @@ void nano::json_handler::confirmation_active ()
 | 
				
			||||||
	response_errors ();
 | 
						response_errors ();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void nano::json_handler::confirmation_height_currently_processing ()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	auto hash = node.confirmation_height_processor.current ();
 | 
					 | 
				
			||||||
	if (!hash.is_zero ())
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		response_l.put ("hash", hash.to_string ());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		ec = nano::error_rpc::confirmation_height_not_processing;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	response_errors ();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void nano::json_handler::confirmation_history ()
 | 
					void nano::json_handler::confirmation_history ()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	boost::property_tree::ptree elections;
 | 
						boost::property_tree::ptree elections;
 | 
				
			||||||
| 
						 | 
					@ -5334,7 +5320,6 @@ ipc_json_handler_no_arg_func_map create_ipc_json_handler_no_arg_func_map ()
 | 
				
			||||||
	no_arg_funcs.emplace ("bootstrap_lazy", &nano::json_handler::bootstrap_lazy);
 | 
						no_arg_funcs.emplace ("bootstrap_lazy", &nano::json_handler::bootstrap_lazy);
 | 
				
			||||||
	no_arg_funcs.emplace ("bootstrap_status", &nano::json_handler::bootstrap_status);
 | 
						no_arg_funcs.emplace ("bootstrap_status", &nano::json_handler::bootstrap_status);
 | 
				
			||||||
	no_arg_funcs.emplace ("confirmation_active", &nano::json_handler::confirmation_active);
 | 
						no_arg_funcs.emplace ("confirmation_active", &nano::json_handler::confirmation_active);
 | 
				
			||||||
	no_arg_funcs.emplace ("confirmation_height_currently_processing", &nano::json_handler::confirmation_height_currently_processing);
 | 
					 | 
				
			||||||
	no_arg_funcs.emplace ("confirmation_history", &nano::json_handler::confirmation_history);
 | 
						no_arg_funcs.emplace ("confirmation_history", &nano::json_handler::confirmation_history);
 | 
				
			||||||
	no_arg_funcs.emplace ("confirmation_info", &nano::json_handler::confirmation_info);
 | 
						no_arg_funcs.emplace ("confirmation_info", &nano::json_handler::confirmation_info);
 | 
				
			||||||
	no_arg_funcs.emplace ("confirmation_quorum", &nano::json_handler::confirmation_quorum);
 | 
						no_arg_funcs.emplace ("confirmation_quorum", &nano::json_handler::confirmation_quorum);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,7 +64,6 @@ public:
 | 
				
			||||||
	void confirmation_history ();
 | 
						void confirmation_history ();
 | 
				
			||||||
	void confirmation_info ();
 | 
						void confirmation_info ();
 | 
				
			||||||
	void confirmation_quorum ();
 | 
						void confirmation_quorum ();
 | 
				
			||||||
	void confirmation_height_currently_processing ();
 | 
					 | 
				
			||||||
	void debug_bootstrap_priority_info ();
 | 
						void debug_bootstrap_priority_info ();
 | 
				
			||||||
	void database_txn_tracker ();
 | 
						void database_txn_tracker ();
 | 
				
			||||||
	void delegators ();
 | 
						void delegators ();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,7 +152,6 @@ std::unordered_set<std::string> create_rpc_control_impls ()
 | 
				
			||||||
	set.emplace ("backoff_info");
 | 
						set.emplace ("backoff_info");
 | 
				
			||||||
	set.emplace ("block_create");
 | 
						set.emplace ("block_create");
 | 
				
			||||||
	set.emplace ("bootstrap_lazy");
 | 
						set.emplace ("bootstrap_lazy");
 | 
				
			||||||
	set.emplace ("confirmation_height_currently_processing");
 | 
					 | 
				
			||||||
	set.emplace ("database_txn_tracker");
 | 
						set.emplace ("database_txn_tracker");
 | 
				
			||||||
	set.emplace ("epoch_upgrade");
 | 
						set.emplace ("epoch_upgrade");
 | 
				
			||||||
	set.emplace ("keepalive");
 | 
						set.emplace ("keepalive");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5202,72 +5202,6 @@ TEST (rpc, online_reps)
 | 
				
			||||||
	node2->stop ();
 | 
						node2->stop ();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST (rpc, confirmation_height_currently_processing)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	nano::test::system system;
 | 
					 | 
				
			||||||
	nano::node_flags node_flags;
 | 
					 | 
				
			||||||
	node_flags.force_use_write_database_queue = true;
 | 
					 | 
				
			||||||
	nano::node_config node_config = system.default_config ();
 | 
					 | 
				
			||||||
	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	auto node = add_ipc_enabled_node (system, node_config, node_flags);
 | 
					 | 
				
			||||||
	system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	auto previous_genesis_chain_hash = node->latest (nano::dev::genesis_key.pub);
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		auto transaction = node->store.tx_begin_write ();
 | 
					 | 
				
			||||||
		nano::keypair key1;
 | 
					 | 
				
			||||||
		nano::block_builder builder;
 | 
					 | 
				
			||||||
		auto send = builder
 | 
					 | 
				
			||||||
					.send ()
 | 
					 | 
				
			||||||
					.previous (previous_genesis_chain_hash)
 | 
					 | 
				
			||||||
					.destination (key1.pub)
 | 
					 | 
				
			||||||
					.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio - 1)
 | 
					 | 
				
			||||||
					.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
 | 
					 | 
				
			||||||
					.work (*system.work.generate (previous_genesis_chain_hash))
 | 
					 | 
				
			||||||
					.build ();
 | 
					 | 
				
			||||||
		ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send));
 | 
					 | 
				
			||||||
		previous_genesis_chain_hash = send->hash ();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	std::shared_ptr<nano::block> frontier;
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		auto transaction = node->store.tx_begin_read ();
 | 
					 | 
				
			||||||
		frontier = node->ledger.block (transaction, previous_genesis_chain_hash);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	boost::property_tree::ptree request;
 | 
					 | 
				
			||||||
	request.put ("action", "confirmation_height_currently_processing");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	auto const rpc_ctx = add_rpc (system, node);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Begin process for confirming the block (and setting confirmation height)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		// Write guard prevents the confirmation height processor writing the blocks, so that we can inspect contents during the response
 | 
					 | 
				
			||||||
		auto write_guard = node->write_database_queue.wait (nano::writer::testing);
 | 
					 | 
				
			||||||
		nano::test::start_election (system, *node, frontier->hash ());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		ASSERT_TIMELY_EQ (5s, node->confirmation_height_processor.current (), frontier->hash ());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Make the request
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			auto response (wait_response (system, rpc_ctx, request, 10s));
 | 
					 | 
				
			||||||
			auto hash (response.get<std::string> ("hash"));
 | 
					 | 
				
			||||||
			ASSERT_EQ (frontier->hash ().to_string (), hash);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Wait until confirmation has been set and not processing anything
 | 
					 | 
				
			||||||
	ASSERT_TIMELY (10s, node->confirmation_height_processor.current ().is_zero () && node->confirmation_height_processor.awaiting_processing_size () == 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Make the same request, it should now return an error
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		auto response (wait_response (system, rpc_ctx, request, 10s));
 | 
					 | 
				
			||||||
		std::error_code ec (nano::error_rpc::confirmation_height_not_processing);
 | 
					 | 
				
			||||||
		ASSERT_EQ (response.get<std::string> ("error"), ec.message ());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST (rpc, confirmation_history)
 | 
					TEST (rpc, confirmation_history)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nano::test::system system;
 | 
						nano::test::system system;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue