Scorum
debug_node_api.hpp
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <memory>
5 #include <string>
6 
7 #include <fc/api.hpp>
8 #include <fc/optional.hpp>
9 #include <fc/variant_object.hpp>
10 
12 
14 
15 namespace scorum {
16 namespace app {
17 struct api_context;
18 }
19 }
20 
21 namespace scorum {
22 namespace plugin {
23 namespace debug_node {
24 
25 namespace detail {
26 class debug_node_api_impl;
27 }
28 
30 {
31  std::string name;
32 };
33 
35 {
36  std::string private_key;
38 };
39 
50 {
51 public:
53 
54  void on_api_startup();
55 
59 
63  uint32_t debug_push_blocks(std::string src_filename, uint32_t count, bool skip_validate_invariants = false);
64 
68  uint32_t debug_generate_blocks(std::string debug_key, uint32_t count);
69 
73  uint32_t debug_generate_blocks_until(std::string debug_key,
74  fc::time_point_sec head_block_time,
75  bool generate_sparsely = true);
76 
80  fc::optional<scorum::chain::signed_block> debug_pop_block();
81 
82  // /*
83  // * @brief Push an already constructed block onto the blockchain. For use with pop_block to traverse state
84  // block by
85  // * block.
86  // * not implemented
87  // */
88  // void debug_push_block(scorum::chain::signed_block& block);
89 
91 
92  scorum::chain::hardfork_property_object debug_get_hardfork_property_object();
93 
94  // /**
95  // * @brief Directly manipulate database objects (will undo and re-apply last block with new changes
96  // post-applied).
97  // */
98  // void debug_update_object(fc::variant_object update);
99 
100  // fc::variant_object debug_get_edits();
101 
102  // void debug_set_edits( fc::variant_object edits );
103 
109  void debug_set_dev_key_prefix(std::string prefix);
110 
115 
116  // /**
117  // * @brief Start a node with given initial path.
118  // *
119  // * not implemented
120  // */
121  // void start_node(std::string name, std::string initial_db_path);
122 
123  // /**
124  // * @brief Save the database to disk.
125  // * not implemented
126  // */
127  // void save_db(std::string db_path);
128 
129  // /**
130  // * @brief Stream objects to file. (Hint: Create with mkfifo and pipe it to a script)
131  // */
132  // void debug_stream_json_objects(std::string filename);
133 
134  // /**
135  // * @brief Flush streaming file.
136  // */
137  // void debug_stream_json_objects_flush();
138 
139  void debug_set_hardfork(uint32_t hardfork_id);
140 
141  bool debug_has_hardfork(uint32_t hardfork_id);
142 
144 
145 private:
146  std::shared_ptr<detail::debug_node_api_impl> my;
147 };
148 } // namespace debug_node
149 } // namespace plugin
150 } // namespace scorum
151 
152 // clang-format off
154 
156 
158  (debug_push_blocks)
159  (debug_generate_blocks)
160  (debug_generate_blocks_until)
161  (debug_pop_block)
162  (debug_set_hardfork)
163  (debug_has_hardfork)
164  (debug_get_witness_schedule)
165  (debug_get_hardfork_property_object)
166  (debug_set_dev_key_prefix)
167  (debug_get_dev_key))
168 
169 // clang-format on
debug_node_api(const scorum::app::api_context &ctx)
scorum::chain::witness_schedule_object debug_get_witness_schedule()
fc::optional< scorum::chain::signed_block > debug_pop_block()
Pop a block from the blockchain, returning it.
get_dev_key_result debug_get_dev_key(get_dev_key_args args)
Get developer key. Use debug_set_key_prefix() to set a prefix if desired.
bool debug_has_hardfork(uint32_t hardfork_id)
void debug_set_dev_key_prefix(std::string prefix)
Set developer key prefix. This prefix only applies to the current API session. (Thus,...
uint32_t debug_generate_blocks(std::string debug_key, uint32_t count)
Generate blocks locally.
uint32_t debug_generate_blocks_until(std::string debug_key, fc::time_point_sec head_block_time, bool generate_sparsely=true)
Generate blocks locally until a specified head block time. Can generate them sparsely.
void debug_set_hardfork(uint32_t hardfork_id)
scorum::chain::hardfork_property_object debug_get_hardfork_property_object()
uint32_t debug_push_blocks(std::string src_filename, uint32_t count, bool skip_validate_invariants=false)
Push blocks from existing database.
FC_REFLECT(appender_args,(appender)(stream)) FC_REFLECT_DERIVED(file_appender_args
Definition: asset.cpp:15