Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions console/executor_dumps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ void executor::dump_progress() const
logger(format(BN_MEASURE_PROGRESS) %
query_.get_fork() %
query_.get_top_confirmed() %
encode_hash(query_.get_header_key(query_.to_confirmed(query_.get_top_confirmed()))) %
encode_hash(query_.get_top_confirmed_hash()) %
query_.get_top_candidate() %
encode_hash(query_.get_header_key(query_.to_candidate(query_.get_top_candidate()))) %
encode_hash(query_.get_top_candidate_hash()) %
query_.get_top_associated() %
(query_.get_top_candidate() - query_.get_unassociated_count()) %
query_.get_confirmed_size() %
Expand Down
6 changes: 4 additions & 2 deletions include/bitcoin/node/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ enum error_t : uint8_t
invalid_subcomponent,
extra_segment,

/// server (json-rpc parse codes)
unexpected_parse
/// server (rpc response codes)
not_found,
invalid_argument,
not_implemented
};

// No current need for error_code equivalence mapping.
Expand Down
6 changes: 3 additions & 3 deletions include/bitcoin/node/interfaces/bitcoind_rpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ struct bitcoind_rpc_methods
{
/// Blockchain methods.
method<"getbestblockhash">{},
method<"getblock", string_t, optional<1>>{ "blockhash", "verbosity" },
method<"getblock", string_t, optional<1.0>>{ "blockhash", "verbosity" },
method<"getblockchaininfo">{},
method<"getblockcount">{},
method<"getblockfilter", string_t, optional<"basic"_t>>{ "blockhash", "filtertype" },
method<"getblockhash", number_t>{ "height" },
method<"getblockheader", string_t, optional<true>>{ "blockhash", "verbose" },
method<"getblockstats", string_t, optional<empty::array>>{ "hash_or_height", "stats" },
method<"getchaintxstats", optional<-1>, optional<""_t>>{ "nblocks", "blockhash" },
method<"getchaintxstats", optional<-1.0>, optional<""_t>>{ "nblocks", "blockhash" },
method<"getchainwork">{},
method<"gettxout", string_t, number_t, optional<true>>{ "txid", "n", "include_mempool" },
method<"gettxoutsetinfo">{},
method<"pruneblockchain", number_t>{ "height" },
method<"savemempool">{},
method<"scantxoutset", string_t, optional<empty::array>>{ "action", "scanobjects" },
method<"verifychain", optional<4>, optional<288>>{ "checklevel", "nblocks" },
method<"verifychain", optional<4.0>, optional<288.0>>{ "checklevel", "nblocks" },
method<"verifytxoutset", string_t>{ "input_verify_flag" },

/////// Control methods.
Expand Down
29 changes: 25 additions & 4 deletions include/bitcoin/node/protocols/protocol_bitcoind_rpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class BCN_API protocol_bitcoind_rpc
bool handle_get_best_block_hash(const code& ec,
rpc_interface::get_best_block_hash) NOEXCEPT;
bool handle_get_block(const code& ec,
rpc_interface::get_block, const std::string&, double) NOEXCEPT;
rpc_interface::get_block, const std::string&,
double verbosity) NOEXCEPT;
bool handle_get_block_chain_info(const code& ec,
rpc_interface::get_block_chain_info) NOEXCEPT;
bool handle_get_block_count(const code& ec,
Expand Down Expand Up @@ -104,18 +105,38 @@ class BCN_API protocol_bitcoind_rpc
bool handle_verify_tx_out_set(const code& ec,
rpc_interface::verify_tx_out_set, const std::string&) NOEXCEPT;

/// Senders.
void send_error(const code& ec) NOEXCEPT;
void send_error(const code& ec, size_t size_hint) NOEXCEPT;
void send_error(const code& ec, network::rpc::value_option&& error,
size_t size_hint) NOEXCEPT;
void send_text(std::string&& hexidecimal) NOEXCEPT;
void send_result(network::rpc::value_option&& result,
size_t size_hint) NOEXCEPT;

private:
template <class Derived, typename Method, typename... Args>
inline void subscribe(Method&& method, Args&&... args) NOEXCEPT
{
rpc_dispatcher_.subscribe(BIND_SHARED(method, args));
}

// Send the response.
void send_json(boost::json::value&& model, size_t size_hint) NOEXCEPT;
// Senders.
void send_rpc(network::rpc::response_t&& model,
size_t size_hint) NOEXCEPT;

// Cache request for serialization (requires strand).
void set_rpc_request(network::rpc::version version,
const network::rpc::id_option& id,
const network::http::request_cptr& request) NOEXCEPT;

// Obtain cached request and clear cache (requires strand).
network::http::request_cptr reset_rpc_request() NOEXCEPT;

// This is protected by strand.
// These are protected by strand.
rpc_dispatcher rpc_dispatcher_{};
network::rpc::version version_{};
network::rpc::id_option id_{};
};

} // namespace node
Expand Down
10 changes: 7 additions & 3 deletions src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
{ duplicate_block, "duplicate block" },
{ duplicate_header, "duplicate header" },

/// faults
// faults
{ protocol1, "protocol1" },
{ protocol2, "protocol2" },
{ header1, "header1" },
Expand Down Expand Up @@ -90,7 +90,7 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
{ confirm12, "confirm12" },
{ confirm13, "confirm13" },

/// server (url parse codes)
// server (url parse codes)
{ empty_path, "empty_path" },
{ invalid_number, "invalid_number" },
{ invalid_hash, "invalid_hash" },
Expand All @@ -107,7 +107,11 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
{ invalid_component, "invalid_component" },
{ invalid_subcomponent, "invalid_subcomponent" },
{ extra_segment, "extra_segment" },
{ unexpected_parse, "unexpected_parse" }

// server (rpc response codes)
{ not_found, "not_found" },
{ invalid_argument, "invalid_argument" },
{ not_implemented, "not_implemented" }
};

DEFINE_ERROR_T_CATEGORY(error, "node", "node code")
Expand Down
Loading
Loading