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

Add overlay certificate checks

This commit is contained in:
OmicronTau 2021-11-13 16:17:17 +03:00 committed by EmelyanenkoK
parent 9e9351903a
commit 678a8a6a13
17 changed files with 232 additions and 62 deletions

View file

@ -18,9 +18,16 @@
*/
#pragma once
#include "adnl/adnl-local-id.h"
#include "adnl/adnl-node-id.hpp"
#include "auto/tl/ton_api.h"
#include "common/refcnt.hpp"
#include "overlay/overlay.h"
#include "td/actor/PromiseFuture.h"
#include "td/utils/List.h"
#include "td/utils/Status.h"
#include "td/utils/buffer.h"
#include "td/utils/common.h"
namespace ton {
@ -38,6 +45,7 @@ class BroadcastSimple : public td::ListNode {
td::BufferSlice data_;
td::uint32 date_;
td::BufferSlice signature_;
bool is_valid_{false};
OverlayImpl *overlay_;
@ -52,7 +60,7 @@ class BroadcastSimple : public td::ListNode {
public:
BroadcastSimple(Overlay::BroadcastHash broadcast_hash, PublicKey source, std::shared_ptr<Certificate> cert,
td::uint32 flags, td::BufferSlice data, td::uint32 date, td::BufferSlice signature,
td::uint32 flags, td::BufferSlice data, td::uint32 date, td::BufferSlice signature, bool is_valid,
OverlayImpl *overlay)
: broadcast_hash_(broadcast_hash)
, source_(std::move(source))
@ -61,6 +69,7 @@ class BroadcastSimple : public td::ListNode {
, data_(std::move(data))
, date_(date)
, signature_(std::move(signature))
, is_valid_(is_valid)
, overlay_(overlay) {
}
@ -80,17 +89,14 @@ class BroadcastSimple : public td::ListNode {
}
void deliver();
td::Status run() {
TRY_STATUS(run_checks());
TRY_STATUS(distribute());
deliver();
return td::Status::OK();
}
td::Status run();
td::Status run_continue();
tl_object_ptr<ton_api::overlay_broadcast> tl() const;
td::BufferSlice serialize();
void update_overlay(OverlayImpl *overlay);
void broadcast_checked(td::Result<td::Unit> R);
static td::Status create(OverlayImpl *overlay, tl_object_ptr<ton_api::overlay_broadcast> broadcast);
static td::Status create_new(td::actor::ActorId<OverlayImpl> overlay, td::actor::ActorId<keyring::Keyring> keyring,