mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add candidates cache (#1000)
* Broadcast shardchain block candidates in private overlays, generate proof links from candidates * Disable shardchain block broadcasts in private overlays * Send block candidate broadcasts to custom overlays, allow non-validators to receive candidates --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
7a74888d2f
commit
539d5dd2de
26 changed files with 382 additions and 20 deletions
|
@ -18,10 +18,14 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "common/refcnt.hpp"
|
||||
#include "interfaces/validator-manager.h"
|
||||
#include "interfaces/db.h"
|
||||
#include "td/actor/PromiseFuture.h"
|
||||
#include "td/utils/SharedSlice.h"
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/port/Poll.h"
|
||||
#include "td/utils/port/StdStreams.h"
|
||||
#include "validator-group.hpp"
|
||||
#include "shard-client.hpp"
|
||||
#include "manager-init.h"
|
||||
|
@ -220,6 +224,10 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
};
|
||||
// DATA FOR COLLATOR
|
||||
std::map<ShardTopBlockDescriptionId, td::Ref<ShardTopBlockDescription>> shard_blocks_;
|
||||
|
||||
std::map<BlockIdExt, ReceivedBlock> cached_block_candidates_;
|
||||
std::list<BlockIdExt> cached_block_candidates_lru_;
|
||||
|
||||
struct ExtMessages {
|
||||
std::map<MessageId<ExtMessage>, std::unique_ptr<MessageExt<ExtMessage>>> ext_messages_;
|
||||
std::map<std::pair<ton::WorkchainId, ton::StdSmcAddress>, std::map<ExtMessage::Hash, MessageId<ExtMessage>>>
|
||||
|
@ -365,6 +373,7 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
|
||||
void new_ihr_message(td::BufferSlice data) override;
|
||||
void new_shard_block(BlockIdExt block_id, CatchainSeqno cc_seqno, td::BufferSlice data) override;
|
||||
void new_block_candidate(BlockIdExt block_id, td::BufferSlice data) override;
|
||||
|
||||
void add_ext_server_id(adnl::AdnlNodeIdShort id) override;
|
||||
void add_ext_server_port(td::uint16 port) override;
|
||||
|
@ -409,7 +418,8 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
void wait_block_signatures_short(BlockIdExt id, td::Timestamp timeout,
|
||||
td::Promise<td::Ref<BlockSignatureSet>> promise) override;
|
||||
|
||||
void set_block_candidate(BlockIdExt id, BlockCandidate candidate, td::Promise<td::Unit> promise) override;
|
||||
void set_block_candidate(BlockIdExt id, BlockCandidate candidate, CatchainSeqno cc_seqno,
|
||||
td::uint32 validator_set_hash, td::Promise<td::Unit> promise) override;
|
||||
|
||||
void wait_block_state_merge(BlockIdExt left_id, BlockIdExt right_id, td::uint32 priority, td::Timestamp timeout,
|
||||
td::Promise<td::Ref<ShardState>> promise) override;
|
||||
|
@ -503,6 +513,7 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
}
|
||||
|
||||
void add_shard_block_description(td::Ref<ShardTopBlockDescription> desc);
|
||||
void add_cached_block_candidate(ReceivedBlock block);
|
||||
|
||||
void register_block_handle(BlockHandle handle);
|
||||
|
||||
|
@ -664,6 +675,9 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
double max_mempool_num() const {
|
||||
return opts_->max_mempool_num();
|
||||
}
|
||||
size_t max_cached_candidates() const {
|
||||
return 128;
|
||||
}
|
||||
|
||||
private:
|
||||
std::map<BlockSeqno, WaitList<td::actor::Actor, td::Unit>> shard_client_waiters_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue