@@ -807,21 +807,21 @@ td::Status SignCertificateQuery::send() {
807
807
auto sign = ton::create_serialize_tl_object<ton::ton_api::engine_validator_sign>(signer_.tl (), std::move (cid));
808
808
auto pub = ton::create_serialize_tl_object<ton::ton_api::engine_validator_exportPublicKey>(signer_.tl ());
809
809
td::actor::send_closure (console_, &ValidatorEngineConsole::envelope_send_query, std::move (pub),
810
- td::PromiseCreator::lambda ([SelfId = actor_id (this )](td::Result<td::BufferSlice> R) {
811
- if (R.is_error ()) {
812
- td::actor::send_closure (SelfId, &SignCertificateQuery::handle_error, R.move_as_error ());
813
- } else {
814
- td::actor::send_closure (SelfId, &SignCertificateQuery::receive_pubkey, R.move_as_ok ());
815
- }
816
- }));
810
+ td::PromiseCreator::lambda ([SelfId = actor_id (this )](td::Result<td::BufferSlice> R) {
811
+ if (R.is_error ()) {
812
+ td::actor::send_closure (SelfId, &SignCertificateQuery::handle_error, R.move_as_error ());
813
+ } else {
814
+ td::actor::send_closure (SelfId, &SignCertificateQuery::receive_pubkey, R.move_as_ok ());
815
+ }
816
+ }));
817
817
td::actor::send_closure (console_, &ValidatorEngineConsole::envelope_send_query, std::move (sign),
818
- td::PromiseCreator::lambda ([SelfId = actor_id (this )](td::Result<td::BufferSlice> R) {
819
- if (R.is_error ()) {
820
- td::actor::send_closure (SelfId, &SignCertificateQuery::handle_error, R.move_as_error ());
821
- } else {
822
- td::actor::send_closure (SelfId, &SignCertificateQuery::receive_signature, R.move_as_ok ());
823
- }
824
- }));
818
+ td::PromiseCreator::lambda ([SelfId = actor_id (this )](td::Result<td::BufferSlice> R) {
819
+ if (R.is_error ()) {
820
+ td::actor::send_closure (SelfId, &SignCertificateQuery::handle_error, R.move_as_error ());
821
+ } else {
822
+ td::actor::send_closure (SelfId, &SignCertificateQuery::receive_signature, R.move_as_ok ());
823
+ }
824
+ }));
825
825
return td::Status::OK ();
826
826
}
827
827
@@ -833,33 +833,32 @@ void SignCertificateQuery::receive_pubkey(td::BufferSlice R) {
833
833
}
834
834
pubkey_ = f.move_as_ok ();
835
835
has_pubkey_ = true ;
836
- if (has_signature_) {
836
+ if (has_signature_) {
837
837
save_certificate ();
838
838
}
839
839
}
840
840
841
-
842
841
td::Status SignCertificateQuery::receive (td::BufferSlice data) {
843
842
UNREACHABLE ();
844
843
}
845
844
846
845
void SignCertificateQuery::receive_signature (td::BufferSlice R) {
847
846
auto f = ton::fetch_tl_object<ton::ton_api::engine_validator_signature>(R.as_slice (), true );
848
- if (f.is_error ()){
847
+ if (f.is_error ()) {
849
848
handle_error (f.move_as_error_prefix (" Failed to get signature: " ));
850
849
return ;
851
850
}
852
851
signature_ = std::move (f.move_as_ok ()->signature_ );
853
- if (has_pubkey_) {
852
+ if (has_pubkey_) {
854
853
save_certificate ();
855
854
}
856
855
}
857
856
858
857
void SignCertificateQuery::save_certificate () {
859
- auto c = ton::create_serialize_tl_object<ton::ton_api::overlay_certificate>(
860
- std::move (pubkey_), expire_at_, max_size_, std::move (signature_));
858
+ auto c = ton::create_serialize_tl_object<ton::ton_api::overlay_certificate>(std::move (pubkey_), expire_at_, max_size_,
859
+ std::move (signature_));
861
860
auto w = td::write_file (out_file_, c.as_slice ());
862
- if (w.is_error ()) {
861
+ if (w.is_error ()) {
863
862
handle_error (w.move_as_error_prefix (" Failed to write certificate to file: " ));
864
863
return ;
865
864
}
@@ -880,11 +879,8 @@ td::Status ImportCertificateQuery::send() {
880
879
TRY_RESULT_PREFIX (cert, ton::fetch_tl_object<ton::ton_api::overlay_Certificate>(data.as_slice (), true ),
881
880
" incorrect certificate" );
882
881
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_importCertificate>(
883
- overlay_,
884
- ton::create_tl_object<ton::ton_api::adnl_id_short>(id_),
885
- ton::create_tl_object<ton::ton_api::engine_validator_keyHash>(kh_.tl ()),
886
- std::move (cert)
887
- );
882
+ overlay_, ton::create_tl_object<ton::ton_api::adnl_id_short>(id_),
883
+ ton::create_tl_object<ton::ton_api::engine_validator_keyHash>(kh_.tl ()), std::move (cert));
888
884
td::actor::send_closure (console_, &ValidatorEngineConsole::envelope_send_query, std::move (b), create_promise ());
889
885
return td::Status::OK ();
890
886
}
@@ -1031,18 +1027,16 @@ td::Status GetOverlaysStatsJsonQuery::receive(td::BufferSlice data) {
1031
1027
return td::Status::OK ();
1032
1028
}
1033
1029
1034
-
1035
1030
td::Status ImportCertificateQuery::receive (td::BufferSlice data) {
1036
1031
TRY_RESULT_PREFIX (f, ton::fetch_tl_object<ton::ton_api::engine_validator_success>(data.as_slice (), true ),
1037
1032
" received incorrect answer: " );
1038
1033
td::TerminalIO::out () << " successfully sent certificate to overlay manager\n " ;
1039
1034
return td::Status::OK ();
1040
1035
}
1041
1036
1042
-
1043
1037
td::Status SignShardOverlayCertificateQuery::run () {
1044
1038
TRY_RESULT_ASSIGN (wc_, tokenizer_.get_token <td::int32>());
1045
- TRY_RESULT_ASSIGN (shard_, tokenizer_.get_token <td::int64>() );
1039
+ TRY_RESULT_ASSIGN (shard_, tokenizer_.get_token <td::int64>());
1046
1040
TRY_RESULT_ASSIGN (key_, tokenizer_.get_token <ton::PublicKeyHash>());
1047
1041
TRY_RESULT_ASSIGN (expire_at_, tokenizer_.get_token <td::int32>());
1048
1042
TRY_RESULT_ASSIGN (max_size_, tokenizer_.get_token <td::uint32>());
@@ -1052,8 +1046,8 @@ td::Status SignShardOverlayCertificateQuery::run() {
1052
1046
}
1053
1047
1054
1048
td::Status SignShardOverlayCertificateQuery::send () {
1055
- auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_signShardOverlayCertificate>
1056
- ( wc_, shard_, ton::create_tl_object<ton::ton_api::engine_validator_keyHash>(key_.tl ()), expire_at_, max_size_);
1049
+ auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_signShardOverlayCertificate>(
1050
+ wc_, shard_, ton::create_tl_object<ton::ton_api::engine_validator_keyHash>(key_.tl ()), expire_at_, max_size_);
1057
1051
td::actor::send_closure (console_, &ValidatorEngineConsole::envelope_send_query, std::move (b), create_promise ());
1058
1052
return td::Status::OK ();
1059
1053
}
@@ -1062,7 +1056,7 @@ td::Status SignShardOverlayCertificateQuery::receive(td::BufferSlice data) {
1062
1056
TRY_RESULT_PREFIX (c, ton::fetch_tl_object<ton::ton_api::overlay_certificate>(data.as_slice (), true ),
1063
1057
" received incorrect cert: " );
1064
1058
auto w = td::write_file (out_file_, data.as_slice ());
1065
- if (w.is_error ()) {
1059
+ if (w.is_error ()) {
1066
1060
return w.move_as_error_prefix (" Failed to write certificate to file: " );
1067
1061
}
1068
1062
td::TerminalIO::out () << " saved certificate\n " ;
@@ -1072,7 +1066,7 @@ td::Status SignShardOverlayCertificateQuery::receive(td::BufferSlice data) {
1072
1066
1073
1067
td::Status ImportShardOverlayCertificateQuery::run () {
1074
1068
TRY_RESULT_ASSIGN (wc_, tokenizer_.get_token <td::int32>());
1075
- TRY_RESULT_ASSIGN (shard_, tokenizer_.get_token <td::int64>() );
1069
+ TRY_RESULT_ASSIGN (shard_, tokenizer_.get_token <td::int64>());
1076
1070
TRY_RESULT_ASSIGN (key_, tokenizer_.get_token <ton::PublicKeyHash>());
1077
1071
TRY_RESULT_ASSIGN (in_file_, tokenizer_.get_token <std::string>());
1078
1072
@@ -1083,8 +1077,8 @@ td::Status ImportShardOverlayCertificateQuery::send() {
1083
1077
TRY_RESULT (data, td::read_file (in_file_));
1084
1078
TRY_RESULT_PREFIX (cert, ton::fetch_tl_object<ton::ton_api::overlay_Certificate>(data.as_slice (), true ),
1085
1079
" incorrect certificate" );
1086
- auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_importShardOverlayCertificate>
1087
- ( wc_, shard_, ton::create_tl_object<ton::ton_api::engine_validator_keyHash>(key_.tl ()), std::move (cert));
1080
+ auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_importShardOverlayCertificate>(
1081
+ wc_, shard_, ton::create_tl_object<ton::ton_api::engine_validator_keyHash>(key_.tl ()), std::move (cert));
1088
1082
td::actor::send_closure (console_, &ValidatorEngineConsole::envelope_send_query, std::move (b), create_promise ());
1089
1083
return td::Status::OK ();
1090
1084
}
@@ -1908,3 +1902,42 @@ td::Status ImportFastSyncMemberCertificateQuery::receive(td::BufferSlice data) {
1908
1902
td::TerminalIO::out () << " success\n " ;
1909
1903
return td::Status::OK ();
1910
1904
}
1905
+
1906
+ td::Status AddFastSyncOverlayClientQuery::run () {
1907
+ TRY_RESULT_ASSIGN (adnl_id_, tokenizer_.get_token <td::Bits256>());
1908
+ TRY_RESULT_ASSIGN (slot_, tokenizer_.get_token <td::int32>());
1909
+ TRY_STATUS (tokenizer_.check_endl ());
1910
+ return td::Status::OK ();
1911
+ }
1912
+
1913
+ td::Status AddFastSyncOverlayClientQuery::send () {
1914
+ auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_addFastSyncClient>(adnl_id_, slot_);
1915
+ td::actor::send_closure (console_, &ValidatorEngineConsole::envelope_send_query, std::move (b), create_promise ());
1916
+ return td::Status::OK ();
1917
+ }
1918
+
1919
+ td::Status AddFastSyncOverlayClientQuery::receive (td::BufferSlice data) {
1920
+ TRY_RESULT_PREFIX (f, ton::fetch_tl_object<ton::ton_api::engine_validator_success>(data.as_slice (), true ),
1921
+ " received incorrect answer: " );
1922
+ td::TerminalIO::out () << " success\n " ;
1923
+ return td::Status::OK ();
1924
+ }
1925
+
1926
+ td::Status DelFastSyncOverlayClientQuery::run () {
1927
+ TRY_RESULT_ASSIGN (adnl_id_, tokenizer_.get_token <td::Bits256>());
1928
+ TRY_STATUS (tokenizer_.check_endl ());
1929
+ return td::Status::OK ();
1930
+ }
1931
+
1932
+ td::Status DelFastSyncOverlayClientQuery::send () {
1933
+ auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_delFastSyncClient>(adnl_id_);
1934
+ td::actor::send_closure (console_, &ValidatorEngineConsole::envelope_send_query, std::move (b), create_promise ());
1935
+ return td::Status::OK ();
1936
+ }
1937
+
1938
+ td::Status DelFastSyncOverlayClientQuery::receive (td::BufferSlice data) {
1939
+ TRY_RESULT_PREFIX (f, ton::fetch_tl_object<ton::ton_api::engine_validator_success>(data.as_slice (), true ),
1940
+ " received incorrect answer: " );
1941
+ td::TerminalIO::out () << " success\n " ;
1942
+ return td::Status::OK ();
1943
+ }
0 commit comments