Skip to content

Commit 730d2c2

Browse files
authored
Merge pull request #897 from evoskuil/master
explore interface WIP.
2 parents 7b5d77a + 19d2376 commit 730d2c2

File tree

6 files changed

+256
-207
lines changed

6 files changed

+256
-207
lines changed

include/bitcoin/node/protocols/protocol_explore.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class BCN_API protocol_explore
105105
bool handle_get_output_spender(const code& ec, interface::output_spender,
106106
uint8_t version, uint8_t media, const system::hash_cptr& hash,
107107
uint32_t index) NOEXCEPT;
108-
bool handle_get_output_spenders(const code& ec, interface::output_spender,
108+
bool handle_get_output_spenders(const code& ec, interface::output_spenders,
109109
uint8_t version, uint8_t media, const system::hash_cptr& hash,
110110
uint32_t index) NOEXCEPT;
111111

include/bitcoin/node/protocols/protocol_html.hpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,21 @@ class BCN_API protocol_html
6060
const network::http::request& request) NOEXCEPT;
6161

6262
/// Senders.
63-
virtual void send_json(const network::http::request& request,
64-
boost::json::value&& model, size_t size_hint) NOEXCEPT;
65-
virtual void send_text(const network::http::request& request,
66-
std::string&& hexidecimal) NOEXCEPT;
67-
virtual void send_chunk(const network::http::request& request,
68-
system::data_chunk&& bytes) NOEXCEPT;
69-
virtual void send_file(const network::http::request& request,
70-
network::http::file&& file, network::http::media_type type) NOEXCEPT;
71-
virtual void send_span(const network::http::request& request,
72-
network::http::span_body::value_type&& span,
73-
network::http::media_type type) NOEXCEPT;
74-
virtual void send_buffer(const network::http::request& request,
75-
network::http::buffer_body::value_type&& buffer,
76-
network::http::media_type type) NOEXCEPT;
63+
virtual void send_json(boost::json::value&& model, size_t size_hint,
64+
const network::http::request& request={}) NOEXCEPT;
65+
virtual void send_text(std::string&& hexidecimal,
66+
const network::http::request& request={}) NOEXCEPT;
67+
virtual void send_chunk(system::data_chunk&& bytes,
68+
const network::http::request& request={}) NOEXCEPT;
69+
virtual void send_file(network::http::file&& file,
70+
network::http::media_type type,
71+
const network::http::request& request={}) NOEXCEPT;
72+
virtual void send_span(network::http::span_body::value_type&& span,
73+
network::http::media_type type,
74+
const network::http::request& request={}) NOEXCEPT;
75+
virtual void send_buffer(network::http::buffer_body::value_type&& buffer,
76+
network::http::media_type type,
77+
const network::http::request& request={}) NOEXCEPT;
7778

7879
/// Utilities.
7980
bool is_allowed_origin(const network::http::fields& fields,

src/parse/target.cpp

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,6 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
130130
return error::missing_component;
131131

132132
const auto component = segments[segment++];
133-
////if (component == "scripts")
134-
////{
135-
//// method = "input_scripts";
136-
////}
137-
////else if (component == "witnesses")
138-
////{
139-
//// method = "input_witnesses";
140-
////}
141-
////else
142-
////{
143133
uint32_t index{};
144134
if (!to_number(index, component))
145135
return error::invalid_number;
@@ -151,15 +141,14 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
151141
}
152142
else
153143
{
154-
auto subcomponent = segments[segment++];
144+
const auto subcomponent = segments[segment++];
155145
if (subcomponent == "script")
156146
method = "input_script";
157147
else if (subcomponent == "witness")
158148
method = "input_witness";
159149
else
160150
return error::invalid_subcomponent;
161151
}
162-
////}
163152
}
164153
else if (target == "output")
165154
{
@@ -174,36 +163,26 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
174163
return error::missing_component;
175164

176165
const auto component = segments[segment++];
177-
////if (component == "scripts")
178-
////{
179-
//// method = "output_scripts";
180-
////}
181-
////else
182-
if (component == "spenders")
166+
uint32_t index{};
167+
if (!to_number(index, component))
168+
return error::invalid_number;
169+
170+
params["index"] = index;
171+
if (segment == segments.size())
183172
{
184-
method = "output_spenders";
173+
method = "output";
185174
}
186175
else
187176
{
188-
uint32_t index{};
189-
if (!to_number(index, component))
190-
return error::invalid_number;
191-
192-
params["index"] = index;
193-
if (segment == segments.size())
194-
{
195-
method = "output";
196-
}
177+
const auto subcomponent = segments[segment++];
178+
if (subcomponent == "script")
179+
method = "output_script";
180+
else if (subcomponent == "spender")
181+
method = "output_spender";
182+
else if (subcomponent == "spenders")
183+
method = "output_spenders";
197184
else
198-
{
199-
auto subcomponent = segments[segment++];
200-
if (subcomponent == "script")
201-
method = "output_script";
202-
else if (subcomponent == "spender")
203-
method = "output_spender";
204-
else
205-
return error::invalid_subcomponent;
206-
}
185+
return error::invalid_subcomponent;
207186
}
208187
}
209188
else if (target == "transaction")

0 commit comments

Comments
 (0)