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:
parent
a1e352d894
commit
07b26e2259
11 changed files with 58 additions and 8 deletions
|
@ -24,7 +24,7 @@ dest_addr 2dup bounce 7 + .Addr ." = " .addr
|
||||||
|
|
||||||
// create a message (NB: 01b00.., b = bounce)
|
// create a message (NB: 01b00.., b = bounce)
|
||||||
<b b{01} s, bounce 1 i, b{000100} s, dest_addr addr,
|
<b b{01} s, bounce 1 i, b{000100} s, dest_addr addr,
|
||||||
amount Gram, 0 9 64 32 + + 1+ 1+ u, "GIFT" $, b>
|
amount Gram, 0 9 64 32 + + 1+ 1+ u, 0 32 u, "GIFT" $, b>
|
||||||
<b seqno 32 u, 1 8 u, swap ref, b>
|
<b seqno 32 u, 1 8 u, swap ref, b>
|
||||||
dup ."enveloping message: " <s csr. cr
|
dup ."enveloping message: " <s csr. cr
|
||||||
<b b{1000100} s, giver_addr addr, 0 Gram, b{00} s,
|
<b b{1000100} s, giver_addr addr, 0 Gram, b{00} s,
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
."Creates a request to simple wallet created by new-wallet.fif, with private key loaded from file <filename-base>.pk "
|
."Creates a request to simple wallet created by new-wallet.fif, with private key loaded from file <filename-base>.pk "
|
||||||
."and address from <filename-base>.addr, and saves it into <savefile>.boc ('wallet-query.boc' by default)" cr 1 halt
|
."and address from <filename-base>.addr, and saves it into <savefile>.boc ('wallet-query.boc' by default)" cr 1 halt
|
||||||
} : usage
|
} : usage
|
||||||
$# dup 4 < swap 5 > or ' usage if
|
|
||||||
def? $6 { @' $5 "-B" $= { @' $6 =: body-boc-file [forget] $6 def? $7 { @' $7 =: $5 [forget] $7 } { [forget] $5 } cond
|
def? $6 { @' $5 "-B" $= { @' $6 =: body-boc-file [forget] $6 def? $7 { @' $7 =: $5 [forget] $7 } { [forget] $5 } cond
|
||||||
@' $# 2- =: $# } if } if
|
@' $# 2- =: $# } if } if
|
||||||
|
$# dup 4 < swap 5 > or ' usage if
|
||||||
|
|
||||||
true constant bounce
|
true constant bounce
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ file-base +".addr" load-address
|
||||||
."Source wallet address = " 2dup .addr cr 6 .Addr cr
|
."Source wallet address = " 2dup .addr cr 6 .Addr cr
|
||||||
file-base +".pk" load-keypair nip constant wallet_pk
|
file-base +".pk" load-keypair nip constant wallet_pk
|
||||||
|
|
||||||
def? body-boc-file { @' body-boc-file file>B B>boc } { <b "TEST" $, b> } cond
|
def? body-boc-file { @' body-boc-file file>B B>boc } { <b 0 32 u, "TEST" $, b> } cond
|
||||||
constant body-cell
|
constant body-cell
|
||||||
|
|
||||||
."Transferring " amount .GR ."to account "
|
."Transferring " amount .GR ."to account "
|
||||||
|
|
|
@ -50,7 +50,7 @@ class DhtRemoteNode {
|
||||||
DhtRemoteNode(DhtNode node, td::uint32 max_missed_pings)
|
DhtRemoteNode(DhtNode node, td::uint32 max_missed_pings)
|
||||||
: node_(std::move(node)), max_missed_pings_(max_missed_pings) {
|
: node_(std::move(node)), max_missed_pings_(max_missed_pings) {
|
||||||
failed_from_ = td::Time::now_cached();
|
failed_from_ = td::Time::now_cached();
|
||||||
id_ = node.get_key();
|
id_ = node_.get_key();
|
||||||
}
|
}
|
||||||
static td::Result<std::unique_ptr<DhtRemoteNode>> create(DhtNode node, td::uint32 max_missed_pings);
|
static td::Result<std::unique_ptr<DhtRemoteNode>> create(DhtNode node, td::uint32 max_missed_pings);
|
||||||
DhtNode get_node() const {
|
DhtNode get_node() const {
|
||||||
|
|
|
@ -89,7 +89,6 @@ class DhtKey {
|
||||||
}
|
}
|
||||||
DhtKey(PublicKeyHash id, DhtKeyName namestr, td::uint32 idx)
|
DhtKey(PublicKeyHash id, DhtKeyName namestr, td::uint32 idx)
|
||||||
: id_(std::move(id)), namestr_(std::move(namestr)), idx_(idx) {
|
: id_(std::move(id)), namestr_(std::move(namestr)), idx_(idx) {
|
||||||
CHECK(namestr.size() <= max_name_length());
|
|
||||||
}
|
}
|
||||||
static td::Result<DhtKey> create(tl_object_ptr<ton_api::dht_key> key);
|
static td::Result<DhtKey> create(tl_object_ptr<ton_api::dht_key> key);
|
||||||
td::Status check() const;
|
td::Status check() const;
|
||||||
|
|
|
@ -358,6 +358,10 @@ tonNode.dataList data:(vector bytes) = tonNode.DataList;
|
||||||
tonNode.dataFull id:tonNode.blockIdExt proof:bytes block:bytes is_link:Bool = tonNode.DataFull;
|
tonNode.dataFull id:tonNode.blockIdExt proof:bytes block:bytes is_link:Bool = tonNode.DataFull;
|
||||||
tonNode.dataFullEmpty = tonNode.DataFull;
|
tonNode.dataFullEmpty = tonNode.DataFull;
|
||||||
|
|
||||||
|
tonNode.capabilities version:int capabilities:long = tonNode.Capabilities;
|
||||||
|
|
||||||
|
tonNode.success = tonNode.Success;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
tonNode.getNextBlockDescription prev_block:tonNode.blockIdExt = tonNode.BlockDescription;
|
tonNode.getNextBlockDescription prev_block:tonNode.blockIdExt = tonNode.BlockDescription;
|
||||||
|
@ -382,7 +386,9 @@ tonNode.downloadBlockProofs blocks:(vector tonNode.blockIdExt) = tonNode.DataLis
|
||||||
tonNode.downloadBlockProofLink block:tonNode.blockIdExt = tonNode.Data;
|
tonNode.downloadBlockProofLink block:tonNode.blockIdExt = tonNode.Data;
|
||||||
tonNode.downloadBlockProofLinks blocks:(vector tonNode.blockIdExt) = tonNode.DataList;
|
tonNode.downloadBlockProofLinks blocks:(vector tonNode.blockIdExt) = tonNode.DataList;
|
||||||
|
|
||||||
tonNode.slave.sendExtMessage message:tonNode.externalMessage = True;
|
tonNode.getCapabilities = tonNode.Capabilities;
|
||||||
|
|
||||||
|
tonNode.slave.sendExtMessage message:tonNode.externalMessage = tonNode.Success;
|
||||||
|
|
||||||
tonNode.query = Object;
|
tonNode.query = Object;
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1679,11 +1679,15 @@ void ValidatorEngine::try_add_validator_temp_key(ton::PublicKeyHash perm_key, to
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td::MultiPromise mp;
|
||||||
|
auto ig = mp.init_guard();
|
||||||
|
ig.add_promise(std::move(promise));
|
||||||
|
|
||||||
if (!validator_manager_.empty()) {
|
if (!validator_manager_.empty()) {
|
||||||
td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManagerInterface::add_temp_key, temp_key,
|
td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManagerInterface::add_temp_key, temp_key,
|
||||||
std::move(promise));
|
ig.get_promise());
|
||||||
}
|
}
|
||||||
write_config(std::move(promise));
|
write_config(ig.get_promise());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidatorEngine::try_add_validator_adnl_addr(ton::PublicKeyHash perm_key, ton::PublicKeyHash adnl_id,
|
void ValidatorEngine::try_add_validator_adnl_addr(ton::PublicKeyHash perm_key, ton::PublicKeyHash adnl_id,
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
|
|
||||||
#include "common/delay.h"
|
#include "common/delay.h"
|
||||||
|
|
||||||
|
#include "auto/tl/lite_api.h"
|
||||||
|
#include "tl-utils/lite-utils.hpp"
|
||||||
|
|
||||||
namespace ton {
|
namespace ton {
|
||||||
|
|
||||||
namespace validator {
|
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));
|
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,
|
void FullNodeMasterImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query,
|
||||||
td::Promise<td::BufferSlice> promise) {
|
td::Promise<td::BufferSlice> promise) {
|
||||||
auto BX = fetch_tl_prefix<ton_api::tonNode_query>(query, true);
|
auto BX = fetch_tl_prefix<ton_api::tonNode_query>(query, true);
|
||||||
|
|
|
@ -28,6 +28,12 @@ namespace fullnode {
|
||||||
|
|
||||||
class FullNodeMasterImpl : public FullNodeMaster {
|
class FullNodeMasterImpl : public FullNodeMaster {
|
||||||
public:
|
public:
|
||||||
|
static constexpr td::uint32 proto_version() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
static constexpr td::uint64 proto_capabilities() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
void start_up() override;
|
void start_up() override;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -62,6 +68,10 @@ class FullNodeMasterImpl : public FullNodeMaster {
|
||||||
td::Promise<td::BufferSlice> promise);
|
td::Promise<td::BufferSlice> promise);
|
||||||
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_downloadPersistentStateSlice &query,
|
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_downloadPersistentStateSlice &query,
|
||||||
td::Promise<td::BufferSlice> promise);
|
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,
|
// void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_prepareNextKeyBlockProof &query,
|
||||||
// td::Promise<td::BufferSlice> promise);
|
// td::Promise<td::BufferSlice> promise);
|
||||||
void receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query, td::Promise<td::BufferSlice> promise);
|
void receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query, td::Promise<td::BufferSlice> promise);
|
||||||
|
|
|
@ -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));
|
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,
|
void FullNodeShardImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query,
|
||||||
td::Promise<td::BufferSlice> promise) {
|
td::Promise<td::BufferSlice> promise) {
|
||||||
auto B = fetch_tl_object<ton_api::Function>(std::move(query), true);
|
auto B = fetch_tl_object<ton_api::Function>(std::move(query), true);
|
||||||
|
|
|
@ -41,6 +41,12 @@ class FullNodeShardImpl : public FullNodeShard {
|
||||||
static constexpr td::uint32 download_next_priority() {
|
static constexpr td::uint32 download_next_priority() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
static constexpr td::uint32 proto_version() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
static constexpr td::uint64 proto_capabilities() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void create_overlay();
|
void create_overlay();
|
||||||
void update_adnl_id(adnl::AdnlNodeIdShort adnl_id, td::Promise<td::Unit> promise) override;
|
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);
|
td::Promise<td::BufferSlice> promise);
|
||||||
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_downloadPersistentStateSlice &query,
|
void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_downloadPersistentStateSlice &query,
|
||||||
td::Promise<td::BufferSlice> promise);
|
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,
|
// void process_query(adnl::AdnlNodeIdShort src, ton_api::tonNode_prepareNextKeyBlockProof &query,
|
||||||
// td::Promise<td::BufferSlice> promise);
|
// td::Promise<td::BufferSlice> promise);
|
||||||
void receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query, td::Promise<td::BufferSlice> promise);
|
void receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice query, td::Promise<td::BufferSlice> promise);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue