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

Limit imported msg queue size

This commit is contained in:
SpyCheese 2023-07-04 23:34:34 +03:00
parent e4e77c16c5
commit 5dd0c15d07
12 changed files with 227 additions and 122 deletions

View file

@ -52,12 +52,20 @@ struct OutputQueueMerger {
bool split(MsgKeyValue& second);
};
//
ton::ShardIdFull queue_for;
std::vector<std::unique_ptr<MsgKeyValue>> msg_list;
std::vector<block::McShardDescr> neighbors;
public:
OutputQueueMerger(ton::ShardIdFull _queue_for, std::vector<block::McShardDescr> _neighbors);
struct Neighbor {
ton::BlockIdExt block_id_;
td::Ref<vm::Cell> outmsg_root_;
bool disabled_;
td::int32 msg_limit_; // -1 - unlimited
Neighbor(ton::BlockIdExt block_id, td::Ref<vm::Cell> outmsg_root, bool disabled = false, td::int32 msg_limit = -1)
: block_id_(block_id), outmsg_root_(std::move(outmsg_root)), disabled_(disabled), msg_limit_(msg_limit) {
}
};
OutputQueueMerger(ton::ShardIdFull queue_for, std::vector<Neighbor> neighbors);
bool is_eof() const {
return eof;
}
@ -70,10 +78,10 @@ struct OutputQueueMerger {
int common_pfx_len;
std::vector<std::unique_ptr<MsgKeyValue>> heap;
std::size_t pos{0};
std::vector<td::int32> src_remaining_msgs_;
bool eof;
bool failed;
void init();
bool add_root(int src, Ref<vm::Cell> outmsg_root);
void add_root(int src, Ref<vm::Cell> outmsg_root, td::int32 msg_limit);
bool load();
};