@@ -950,47 +950,43 @@ impl LDNApplication {
950
950
let app_state: AppState = application_file. lifecycle . get_state ( ) ;
951
951
log:: info!( "- App state is {:?}" , app_state. as_str( ) ) ;
952
952
if app_state < AppState :: Granted {
953
- log:: warn!( "- State is less than StartSignDatacap " ) ;
953
+ log:: warn!( "- State is less than Granted " ) ;
954
954
return Ok ( false ) ;
955
- }
956
- match app_state {
957
- AppState :: Granted => {
958
- dbg ! ( "State is StartSignDatacap" ) ;
959
- let active_request_id = match application_file. clone ( ) . lifecycle . get_active_allocation_id ( ) {
960
- Some ( id) => id,
961
- None => {
962
- log:: warn!( "- No active request" ) ;
963
- return Ok ( false ) ;
964
- }
965
- } ;
966
- let active_request = match application_file. allocation . find_one ( active_request_id) {
967
- Some ( request) => request,
968
- None => {
969
- log:: warn!( "- No active request" ) ;
970
- return Ok ( false ) ;
971
- }
972
- } ;
973
- let signers: application:: file:: Notaries = active_request. signers . clone ( ) ;
974
- if signers. 0 . len ( ) != 2 {
975
- log:: warn!( "- Not enough signers" ) ;
955
+ } else if app_state == AppState :: Granted {
956
+ let active_request_id = match application_file. clone ( ) . lifecycle . get_active_allocation_id ( ) {
957
+ Some ( id) => id,
958
+ None => {
959
+ log:: warn!( "- No active request" ) ;
976
960
return Ok ( false ) ;
977
961
}
978
- let signer = signers. 0 . get ( 1 ) . unwrap ( ) ;
979
- let signer_address = signer. signing_address . clone ( ) ;
980
- let valid_notaries = Self :: fetch_notaries ( ) . await ?;
981
- if valid_notaries. is_valid ( & signer_address) {
982
- log:: info!( "- Validated!" ) ;
983
-
984
- Self :: issue_datacap_request_signature ( application_file. clone ( ) , "approved" . to_string ( ) ) . await ?;
985
- Self :: update_issue_labels ( application_file. issue_number . clone ( ) , & [ AppState :: Granted . as_str ( ) ] ) . await ?;
986
- Self :: issue_granted ( application_file. issue_number . clone ( ) ) . await ?;
987
-
988
- return Ok ( true ) ;
962
+ } ;
963
+ let active_request = match application_file. allocation . find_one ( active_request_id) {
964
+ Some ( request) => request,
965
+ None => {
966
+ log:: warn!( "- No active request" ) ;
967
+ return Ok ( false ) ;
989
968
}
990
- log:: warn!( "- Not validated!" ) ;
991
- Ok ( false )
969
+ } ;
970
+ let signers: application:: file:: Notaries = active_request. signers . clone ( ) ;
971
+ if signers. 0 . len ( ) != 2 {
972
+ log:: warn!( "- Not enough signers" ) ;
973
+ return Ok ( false ) ;
992
974
}
993
- _ => Ok ( true ) ,
975
+ let signer = signers. 0 . get ( 1 ) . unwrap ( ) ;
976
+ let signer_address = signer. signing_address . clone ( ) ;
977
+ let valid_notaries = Self :: fetch_notaries ( ) . await ?;
978
+ if valid_notaries. is_valid ( & signer_address) {
979
+ log:: info!( "- Validated!" ) ;
980
+ Self :: issue_datacap_request_signature ( application_file. clone ( ) , "approved" . to_string ( ) ) . await ?;
981
+ Self :: update_issue_labels ( application_file. issue_number . clone ( ) , & [ AppState :: Granted . as_str ( ) ] ) . await ?;
982
+ Self :: issue_granted ( application_file. issue_number . clone ( ) ) . await ?;
983
+ return Ok ( true ) ;
984
+ }
985
+ log:: warn!( "- Not validated!" ) ;
986
+ Ok ( false )
987
+ } else {
988
+ log:: info!( "- State is greater than Granted" ) ;
989
+ Ok ( true )
994
990
}
995
991
}
996
992
Err ( e) => Err ( LDNError :: Load ( format ! (
@@ -1008,38 +1004,35 @@ impl LDNApplication {
1008
1004
let app_state: AppState = application_file. lifecycle . get_state ( ) ;
1009
1005
log:: info!( "- App state is {:?}" , app_state. as_str( ) ) ;
1010
1006
if app_state < AppState :: StartSignDatacap {
1011
- log:: warn!( "- State is less than ReadyToSign " ) ;
1007
+ log:: warn!( "- State is less than StartSignDatacap " ) ;
1012
1008
return Ok ( false ) ;
1013
- }
1014
- match app_state {
1015
- AppState :: StartSignDatacap => {
1016
- let active_request = application_file. allocation . active ( ) ;
1017
- if active_request. is_none ( ) {
1018
- log:: warn!( "- No active request" ) ;
1019
- return Ok ( false ) ;
1020
- }
1021
- let active_request = active_request. unwrap ( ) ;
1022
- let signers = active_request. signers . clone ( ) ;
1023
- if signers. 0 . len ( ) != 1 {
1024
- log:: warn!( "- Not enough signers" ) ;
1025
- return Ok ( false ) ;
1026
- }
1027
- let signer = signers. 0 . get ( 0 ) . unwrap ( ) ;
1028
- let signer_address = signer. signing_address . clone ( ) ;
1029
- let valid_notaries = Self :: fetch_notaries ( ) . await ?;
1030
- if valid_notaries. is_valid ( & signer_address) {
1031
- log:: info!( "- Validated!" ) ;
1032
-
1033
- Self :: issue_start_sign_dc ( application_file. issue_number . clone ( ) ) . await ?;
1034
- Self :: issue_datacap_request_signature ( application_file. clone ( ) , "proposed" . to_string ( ) ) . await ?;
1035
- Self :: update_issue_labels ( application_file. issue_number . clone ( ) , & [ AppState :: StartSignDatacap . as_str ( ) ] ) . await ?;
1036
-
1037
- return Ok ( true ) ;
1038
- }
1039
- log:: warn!( "- Not validated!" ) ;
1040
- Ok ( false )
1009
+ } else if app_state == AppState :: StartSignDatacap {
1010
+ let active_request = application_file. allocation . active ( ) ;
1011
+ if active_request. is_none ( ) {
1012
+ log:: warn!( "- No active request" ) ;
1013
+ return Ok ( false ) ;
1041
1014
}
1042
- _ => Ok ( true ) ,
1015
+ let active_request = active_request. unwrap ( ) ;
1016
+ let signers = active_request. signers . clone ( ) ;
1017
+ if signers. 0 . len ( ) != 1 {
1018
+ log:: warn!( "- Not enough signers" ) ;
1019
+ return Ok ( false ) ;
1020
+ }
1021
+ let signer = signers. 0 . get ( 0 ) . unwrap ( ) ;
1022
+ let signer_address = signer. signing_address . clone ( ) ;
1023
+ let valid_notaries = Self :: fetch_notaries ( ) . await ?;
1024
+ if valid_notaries. is_valid ( & signer_address) {
1025
+ Self :: issue_start_sign_dc ( application_file. issue_number . clone ( ) ) . await ?;
1026
+ Self :: issue_datacap_request_signature ( application_file. clone ( ) , "proposed" . to_string ( ) ) . await ?;
1027
+ Self :: update_issue_labels ( application_file. issue_number . clone ( ) , & [ AppState :: StartSignDatacap . as_str ( ) ] ) . await ?;
1028
+ log:: info!( "- Validated!" ) ;
1029
+ return Ok ( true ) ;
1030
+ }
1031
+ log:: warn!( "- Not validated!" ) ;
1032
+ Ok ( false )
1033
+ } else {
1034
+ log:: info!( "- State is greater than StartSignDatacap" ) ;
1035
+ Ok ( true )
1043
1036
}
1044
1037
}
1045
1038
Err ( e) => Err ( LDNError :: Load ( format ! (
@@ -1236,6 +1229,7 @@ Your Datacap Allocation Request has been {} by the Notary
1236
1229
. unwrap ( ) ;
1237
1230
Ok ( true )
1238
1231
}
1232
+
1239
1233
async fn issue_start_sign_dc ( issue_number : String ) -> Result < bool , LDNError > {
1240
1234
let gh = GithubWrapper :: new ( ) ;
1241
1235
gh. add_comment_to_issue (
0 commit comments