mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge branch 'testnet' into block-generation
# Conflicts: # adnl/adnl-query.cpp # crypto/block/block.tlb # crypto/block/mc-config.h # lite-client/lite-client.cpp # overlay/overlay-manager.h # overlay/overlay-peers.cpp # overlay/overlay.cpp # overlay/overlay.h # overlay/overlay.hpp # overlay/overlays.h # rldp-http-proxy/DNSResolver.cpp # rldp-http-proxy/rldp-http-proxy.cpp # tl/generate/scheme/ton_api.tl # tl/generate/scheme/ton_api.tlo # tl/generate/scheme/tonlib_api.tlo # ton/ton-types.h # tonlib/tonlib/ExtClient.cpp # tonlib/tonlib/ExtClient.h # tonlib/tonlib/ExtClientLazy.cpp # tonlib/tonlib/ExtClientOutbound.h # tonlib/tonlib/ExtClientRaw.h # tonlib/tonlib/TonlibClient.cpp # tonlib/tonlib/TonlibClient.h # tonlib/tonlib/tonlib-cli.cpp # validator/impl/collator.cpp # validator/impl/validate-query.cpp # validator/impl/validate-query.hpp # validator/manager.cpp # validator/state-serializer.cpp # validator/state-serializer.hpp # validator/validator-group.cpp # validator/validator-group.hpp # validator/validator.h
This commit is contained in:
commit
d652f7d706
200 changed files with 13492 additions and 2997 deletions
|
|
@ -38,10 +38,10 @@ td::actor::ActorOwn<Overlay> Overlay::create(td::actor::ActorId<keyring::Keyring
|
|||
td::actor::ActorId<OverlayManager> manager,
|
||||
td::actor::ActorId<dht::Dht> dht_node, adnl::AdnlNodeIdShort local_id,
|
||||
OverlayIdFull overlay_id, std::unique_ptr<Overlays::Callback> callback,
|
||||
OverlayPrivacyRules rules, td::string scope, bool is_external) {
|
||||
OverlayPrivacyRules rules, td::string scope, bool announce_self) {
|
||||
auto R = td::actor::create_actor<OverlayImpl>("overlay", keyring, adnl, manager, dht_node, local_id,
|
||||
std::move(overlay_id), true, std::vector<adnl::AdnlNodeIdShort>(),
|
||||
std::move(callback), std::move(rules), scope, is_external);
|
||||
std::move(callback), std::move(rules), scope, announce_self);
|
||||
return td::actor::ActorOwn<Overlay>(std::move(R));
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ OverlayImpl::OverlayImpl(td::actor::ActorId<keyring::Keyring> keyring, td::actor
|
|||
td::actor::ActorId<OverlayManager> manager, td::actor::ActorId<dht::Dht> dht_node,
|
||||
adnl::AdnlNodeIdShort local_id, OverlayIdFull overlay_id, bool pub,
|
||||
std::vector<adnl::AdnlNodeIdShort> nodes, std::unique_ptr<Overlays::Callback> callback,
|
||||
OverlayPrivacyRules rules, td::string scope, bool is_external)
|
||||
OverlayPrivacyRules rules, td::string scope, bool announce_self)
|
||||
: keyring_(keyring)
|
||||
, adnl_(adnl)
|
||||
, manager_(manager)
|
||||
|
|
@ -72,15 +72,10 @@ OverlayImpl::OverlayImpl(td::actor::ActorId<keyring::Keyring> keyring, td::actor
|
|||
, public_(pub)
|
||||
, rules_(std::move(rules))
|
||||
, scope_(scope)
|
||||
, is_external_(is_external) {
|
||||
, announce_self_(announce_self) {
|
||||
overlay_id_ = id_full_.compute_short_id();
|
||||
|
||||
if (is_external_) {
|
||||
CHECK(public_);
|
||||
VLOG(OVERLAY_INFO) << this << ": creating public external";
|
||||
} else {
|
||||
VLOG(OVERLAY_INFO) << this << ": creating " << (public_ ? "public" : "private");
|
||||
}
|
||||
VLOG(OVERLAY_INFO) << this << ": creating " << (public_ ? "public" : "private");
|
||||
|
||||
for (auto &node : nodes) {
|
||||
CHECK(!public_);
|
||||
|
|
@ -139,13 +134,6 @@ void OverlayImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::overlay_getB
|
|||
}
|
||||
|
||||
void OverlayImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice data, td::Promise<td::BufferSlice> promise) {
|
||||
if (is_external_) {
|
||||
LOG(OVERLAY_WARNING) << "dropping query in external overlay " << overlay_id_;
|
||||
promise.set_error(td::Status::Error("overlay is external"));
|
||||
td::actor::send_closure(manager_, &Overlays::send_message, src, local_id_, overlay_id_,
|
||||
create_serialize_tl_object<ton_api::overlay_message_removePeer>());
|
||||
return;
|
||||
}
|
||||
if (!public_) {
|
||||
auto P = peers_.get(src);
|
||||
if (P == nullptr) {
|
||||
|
|
@ -153,6 +141,8 @@ void OverlayImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice data,
|
|||
promise.set_error(td::Status::Error(ErrorCode::protoviolation, "overlay is private"));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
on_ping_result(src, true);
|
||||
}
|
||||
auto R = fetch_tl_object<ton_api::Function>(data.clone(), true);
|
||||
|
||||
|
|
@ -231,24 +221,10 @@ void OverlayImpl::receive_message(adnl::AdnlNodeIdShort src, td::BufferSlice dat
|
|||
VLOG(OVERLAY_WARNING) << this << ": received query in private overlay from unknown source " << src;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
on_ping_result(src, true);
|
||||
}
|
||||
auto X = fetch_tl_object<ton_api::overlay_Broadcast>(data.clone(), true);
|
||||
if (X.is_error()) {
|
||||
auto Y = fetch_tl_object<ton_api::overlay_message_removePeer>(data.clone(), true);
|
||||
if (Y.is_ok() && public_) {
|
||||
VLOG(OVERLAY_DEBUG) << this << ": received removePeer message from " << src;
|
||||
if (peers_.exists(src)) {
|
||||
del_peer(src);
|
||||
}
|
||||
callback_->on_remove_peer(src);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_external_) {
|
||||
LOG(OVERLAY_WARNING) << "dropping message in external overlay " << overlay_id_;
|
||||
return;
|
||||
}
|
||||
if (X.is_error()) {
|
||||
VLOG(OVERLAY_DEBUG) << this << ": received custom message";
|
||||
callback_->receive_message(src, overlay_id_, std::move(data));
|
||||
|
|
@ -349,7 +325,7 @@ void OverlayImpl::receive_dht_nodes(td::Result<dht::DhtValue> res, bool dummy) {
|
|||
VLOG(OVERLAY_NOTICE) << this << ": can not get value from DHT: " << res.move_as_error();
|
||||
}
|
||||
|
||||
if (is_external_) {
|
||||
if (!announce_self_) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -555,9 +531,6 @@ void OverlayImpl::send_new_fec_broadcast_part(PublicKeyHash local_id, Overlay::B
|
|||
}
|
||||
|
||||
void OverlayImpl::deliver_broadcast(PublicKeyHash source, td::BufferSlice data) {
|
||||
if (is_external_) {
|
||||
return;
|
||||
}
|
||||
callback_->receive_broadcast(source, overlay_id_, std::move(data));
|
||||
}
|
||||
|
||||
|
|
@ -630,10 +603,6 @@ void OverlayImpl::set_privacy_rules(OverlayPrivacyRules rules) {
|
|||
}
|
||||
|
||||
void OverlayImpl::check_broadcast(PublicKeyHash src, td::BufferSlice data, td::Promise<td::Unit> promise) {
|
||||
if (is_external_) {
|
||||
promise.set_result(td::Unit());
|
||||
return;
|
||||
}
|
||||
callback_->check_broadcast(src, overlay_id_, std::move(data), std::move(promise));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue