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

Block broadcasts in custom overlays (#986)

Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
EmelyanenkoK 2024-05-10 17:04:49 +03:00 committed by GitHub
parent 6fb2019a4f
commit d5c09936cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 234 additions and 134 deletions

View file

@ -27,6 +27,7 @@
#include <map>
#include <set>
#include <queue>
namespace ton {
@ -53,9 +54,8 @@ class FullNodeImpl : public FullNode {
void update_adnl_id(adnl::AdnlNodeIdShort adnl_id, td::Promise<td::Unit> promise) override;
void set_config(FullNodeConfig config) override;
void add_ext_msg_overlay(std::vector<adnl::AdnlNodeIdShort> nodes, std::map<adnl::AdnlNodeIdShort, int> senders,
std::string name, td::Promise<td::Unit> promise) override;
void del_ext_msg_overlay(std::string name, td::Promise<td::Unit> promise) override;
void add_custom_overlay(CustomOverlayParams params, td::Promise<td::Unit> promise) override;
void del_custom_overlay(std::string name, td::Promise<td::Unit> promise) override;
void add_shard(ShardIdFull shard);
void del_shard(ShardIdFull shard);
@ -66,7 +66,7 @@ class FullNodeImpl : public FullNode {
void send_ihr_message(AccountIdPrefixFull dst, td::BufferSlice data);
void send_ext_message(AccountIdPrefixFull dst, td::BufferSlice data);
void send_shard_block_info(BlockIdExt block_id, CatchainSeqno cc_seqnp, td::BufferSlice data);
void send_broadcast(BlockBroadcast broadcast);
void send_broadcast(BlockBroadcast broadcast, bool custom_overlays_only);
void download_block(BlockIdExt id, td::uint32 priority, td::Timestamp timeout, td::Promise<ReceivedBlock> promise);
void download_zero_state(BlockIdExt id, td::uint32 priority, td::Timestamp timeout,
td::Promise<td::BufferSlice> promise);
@ -83,6 +83,8 @@ class FullNodeImpl : public FullNode {
void got_key_block_state(td::Ref<ShardState> state);
void new_key_block(BlockHandle handle);
void process_block_broadcast(BlockBroadcast broadcast) override;
void start_up() override;
FullNodeImpl(PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash,
@ -123,18 +125,19 @@ class FullNodeImpl : public FullNode {
std::map<PublicKeyHash, td::actor::ActorOwn<FullNodePrivateBlockOverlay>> private_block_overlays_;
bool private_block_overlays_enable_compression_ = false;
struct ExtMsgOverlayInfo {
std::vector<adnl::AdnlNodeIdShort> nodes_;
std::map<adnl::AdnlNodeIdShort, int> senders_;
std::map<adnl::AdnlNodeIdShort, td::actor::ActorOwn<FullNodeCustomOverlay>>
actors_; // our local id -> actor
struct CustomOverlayInfo {
CustomOverlayParams params_;
std::map<adnl::AdnlNodeIdShort, td::actor::ActorOwn<FullNodeCustomOverlay>> actors_; // our local id -> actor
};
std::map<std::string, ExtMsgOverlayInfo> private_custom_overlays_;
std::map<std::string, CustomOverlayInfo> custom_overlays_;
std::set<BlockIdExt> custom_overlays_sent_broadcasts_;
std::queue<BlockIdExt> custom_overlays_sent_broadcasts_lru_;
void update_private_overlays();
void set_private_block_overlays_enable_compression(bool value);
void create_private_block_overlay(PublicKeyHash key);
void update_ext_msg_overlay(const std::string& name, ExtMsgOverlayInfo& overlay);
void update_custom_overlay(CustomOverlayInfo& overlay);
void send_block_broadcast_to_custom_overlays(const BlockBroadcast& broadcast);
};
} // namespace fullnode