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

Automatically issue and import fast sync overlay certificates

This commit is contained in:
SpyCheese 2024-12-04 18:06:19 +03:00
parent 09c4488fbf
commit 378b5e94c8
12 changed files with 661 additions and 183 deletions

View file

@ -308,7 +308,7 @@ void FullNodeFastSyncOverlay::init() {
options.default_permanent_members_flags_ = overlay::OverlayMemberFlags::DoNotReceiveBroadcasts;
}
options.local_overlay_member_flags_ = receive_broadcasts_ ? 0 : overlay::OverlayMemberFlags::DoNotReceiveBroadcasts;
options.max_slaves_in_semiprivate_overlay_ = 100000; // TODO: set lower limit (high limit for testing)
options.max_slaves_in_semiprivate_overlay_ = FullNode::MAX_FAST_SYNC_OVERLAY_CLIENTS;
td::actor::send_closure(overlays_, &overlay::Overlays::create_semiprivate_overlay, local_id_,
overlay_id_full_.clone(), current_validators_adnl_, root_public_keys_, member_certificate_,
std::make_unique<Callback>(actor_id(this)), rules, std::move(scope), options);

View file

@ -111,6 +111,8 @@ class FullNode : public td::actor::Actor {
}
enum { broadcast_mode_public = 1, broadcast_mode_private_block = 2, broadcast_mode_custom = 4 };
static constexpr td::int32 MAX_FAST_SYNC_OVERLAY_CLIENTS = 5000; // TODO: set lower limit (high limit for testing)
static td::actor::ActorOwn<FullNode> create(
ton::PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash, FullNodeConfig config,
td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,

View file

@ -100,7 +100,10 @@ class FullNodeImpl : public FullNode {
void set_validator_telemetry_filename(std::string value) override;
void import_fast_sync_member_certificate(adnl::AdnlNodeIdShort local_id,
overlay::OverlayMemberCertificate cert) override {
overlay::OverlayMemberCertificate cert) override {
VLOG(FULL_NODE_DEBUG) << "Importing fast sync overlay certificate for " << local_id << " issued by "
<< cert.issued_by().compute_short_id() << " expires in "
<< (double)cert.expire_at() - td::Clocks::system();
fast_sync_overlays_.add_member_certificate(local_id, std::move(cert));
}