11
11
#include " blockchain/block_tree_error.hpp"
12
12
#include " consensus/beefy/digest.hpp"
13
13
#include " consensus/beefy/sig.hpp"
14
+ #include " consensus/timeline/timeline.hpp"
14
15
#include " crypto/crypto_store/session_keys.hpp"
15
16
#include " metrics/histogram_timer.hpp"
16
17
#include " network/beefy/protocol.hpp"
@@ -40,6 +41,7 @@ namespace kagome::network {
40
41
std::shared_ptr<storage::SpacedStorage> db,
41
42
std::shared_ptr<ThreadPool> thread_pool,
42
43
std::shared_ptr<boost::asio::io_context> main_thread,
44
+ LazySPtr<consensus::Timeline> timeline,
43
45
std::shared_ptr<crypto::SessionKeys> session_keys,
44
46
LazySPtr<BeefyProtocol> beefy_protocol,
45
47
std::shared_ptr<primitives::events::ChainSubscriptionEngine>
@@ -51,6 +53,7 @@ namespace kagome::network {
51
53
strand_inner_{thread_pool->io_context ()},
52
54
strand_{*strand_inner_},
53
55
main_thread_{std::move (main_thread)},
56
+ timeline_{std::move (timeline)},
54
57
session_keys_{std::move (session_keys)},
55
58
beefy_protocol_{std::move (beefy_protocol)},
56
59
min_delta_{chain_spec.isWococo () ? 4u : 8u },
@@ -382,6 +385,9 @@ namespace kagome::network {
382
385
}
383
386
384
387
outcome::result<void > Beefy::vote () {
388
+ if (not timeline_.get ()->wasSynchronized ()) {
389
+ return outcome::success ();
390
+ }
385
391
auto next_session = sessions_.upper_bound (beefy_finalized_ + 1 );
386
392
if (next_session == sessions_.begin ()) {
387
393
SL_VERBOSE (log_, " can't vote: no sessions" );
0 commit comments