This repository was archived by the owner on Feb 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ use middleware_result::*;
1212use models:: * ;
1313use node:: * ;
1414use serde_json;
15- use std:: slice:: SliceConcatExt ;
1615use std:: sync:: mpsc;
1716use std:: sync:: mpsc:: { Receiver , Sender } ;
1817use std:: thread;
@@ -142,13 +141,12 @@ impl BlockLoader {
142141 serde_json:: from_value ( node. get_generation_at_height ( current_height) ?) ?;
143142 if !gen_from_db. eq ( & gen_from_server) {
144143 debug ! ( "Generations don't match at height {}" , current_height) ;
145- in_fork = true ;
146144 fork_was_detected = true ;
147- break ;
145+ in_fork = true ;
148146 }
149147
150- let mut differences = vec ! [ ] ;
151- if !in_fork {
148+ if ! in_fork {
149+ let mut differences ;
152150 for i in 0 ..gen_from_db. micro_blocks . len ( ) {
153151 differences = BlockLoader :: compare_micro_blocks (
154152 & node,
@@ -164,6 +162,7 @@ impl BlockLoader {
164162 }
165163 }
166164 }
165+
167166 if !in_fork {
168167 debug ! ( "No fork found. Exiting loop" ) ;
169168 break ;
Original file line number Diff line number Diff line change @@ -1068,6 +1068,12 @@ fn status(_state: State<MiddlewareServer>) -> Response {
10681068 response. finalize ( )
10691069}
10701070
1071+ #[ get( "/api" ) ]
1072+ fn swagger ( ) -> JsonValue {
1073+ let swagger_str = include_str ! ( "../swagger/swagger.json" ) ;
1074+ serde_json:: from_str ( swagger_str) . unwrap ( )
1075+ }
1076+
10711077impl MiddlewareServer {
10721078 pub fn start ( self ) {
10731079 let allowed_origins = AllowedOrigins :: all ( ) ;
@@ -1098,6 +1104,7 @@ impl MiddlewareServer {
10981104 . mount ( "/middleware" , routes ! [ reward_at_height] )
10991105 . mount ( "/middleware" , routes ! [ size] )
11001106 . mount ( "/middleware" , routes ! [ status] )
1107+ . mount ( "/middleware" , routes ! [ swagger] )
11011108 . mount ( "/middleware" , routes ! [ transaction_rate] )
11021109 . mount ( "/middleware" , routes ! [ transactions_for_account] )
11031110 . mount ( "/middleware" , routes ! [ transactions_for_account_to_account] )
Original file line number Diff line number Diff line change @@ -234,16 +234,6 @@ pub fn clients_for_object(candidate: &Candidate) -> Vec<Client> {
234234 }
235235}
236236
237- fn match_objects ( objects : Vec < String > , tx : String ) -> bool {
238- let tx_objects = get_objects ( tx) ;
239- for object in objects {
240- if tx_objects. contains ( & object) {
241- return true ;
242- }
243- }
244- false
245- }
246-
247237pub fn get_objects ( tx : String ) -> HashSet < String > {
248238 lazy_static ! {
249239 static ref OBJECT_REGEX : Regex = Regex :: new(
You can’t perform that action at this time.
0 commit comments