1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

fullnode: added getCapabilities query

This commit is contained in:
ton 2019-09-24 14:20:26 +04:00
parent a1e352d894
commit 07b26e2259
11 changed files with 58 additions and 8 deletions

View file

@ -27,6 +27,9 @@
#include "common/delay.h"
#include "auto/tl/lite_api.h"
#include "tl-utils/lite-utils.hpp"
namespace ton {
namespace validator {
@ -301,6 +304,21 @@ void FullNodeMasterImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::tonNo
masterchain_block_id, query.offset_, query.max_size_, std::move(P));
}
void FullNodeMasterImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_getCapabilities &query,
td::Promise<td::BufferSlice> promise) {
promise.set_value(create_serialize_tl_object<ton_api::tonNode_capabilities>(proto_version(), proto_capabilities()));
}
void FullNodeMasterImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_slave_sendExtMessage &query,
td::Promise<td::BufferSlice> promise) {
td::actor::send_closure(
validator_manager_, &ValidatorManagerInterface::run_ext_query,
create_serialize_tl_object<lite_api::liteServer_query>(
create_serialize_tl_object<lite_api::liteServer_sendMessage>(std::move(query.message_->data_))),
[&](td::Result<td::BufferSlice>) {});
promise.set_value(create_serialize_tl_object<ton_api::tonNode_success>());
}
void FullNodeMasterImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query,
td::Promise<td::BufferSlice> promise) {
auto BX = fetch_tl_prefix<ton_api::tonNode_query>(query, true);

View file

@ -28,6 +28,12 @@ namespace fullnode {
class FullNodeMasterImpl : public FullNodeMaster {
public:
static constexpr td::uint32 proto_version() {
return 1;
}
static constexpr td::uint64 proto_capabilities() {
return 0;
}
void start_up() override;
template <class T>
@ -62,6 +68,10 @@ class FullNodeMasterImpl : public FullNodeMaster {
td::Promise<td::BufferSlice> promise);
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_downloadPersistentStateSlice &query,
td::Promise<td::BufferSlice> promise);
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_getCapabilities &query,
td::Promise<td::BufferSlice> promise);
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_slave_sendExtMessage &query,
td::Promise<td::BufferSlice> promise);
// void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_prepareNextKeyBlockProof &query,
// td::Promise<td::BufferSlice> promise);
void receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query, td::Promise<td::BufferSlice> promise);

View file

@ -416,6 +416,11 @@ void FullNodeShardImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::tonNod
masterchain_block_id, query.offset_, query.max_size_, std::move(P));
}
void FullNodeShardImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_getCapabilities &query,
td::Promise<td::BufferSlice> promise) {
promise.set_value(create_serialize_tl_object<ton_api::tonNode_capabilities>(proto_version(), proto_capabilities()));
}
void FullNodeShardImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query,
td::Promise<td::BufferSlice> promise) {
auto B = fetch_tl_object<ton_api::Function>(std::move(query), true);

View file

@ -41,6 +41,12 @@ class FullNodeShardImpl : public FullNodeShard {
static constexpr td::uint32 download_next_priority() {
return 1;
}
static constexpr td::uint32 proto_version() {
return 1;
}
static constexpr td::uint64 proto_capabilities() {
return 0;
}
void create_overlay();
void update_adnl_id(adnl::AdnlNodeIdShort adnl_id, td::Promise<td::Unit> promise) override;
@ -84,6 +90,8 @@ class FullNodeShardImpl : public FullNodeShard {
td::Promise<td::BufferSlice> promise);
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_downloadPersistentStateSlice &query,
td::Promise<td::BufferSlice> promise);
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_getCapabilities &query,
td::Promise<td::BufferSlice> promise);
// void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_prepareNextKeyBlockProof &query,
// td::Promise<td::BufferSlice> promise);
void receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query, td::Promise<td::BufferSlice> promise);