@@ -33,6 +33,7 @@ use actix::Message;
3333use actix:: { Addr , Recipient } ;
3434use itertools:: Itertools ;
3535use masq_lib:: blockchains:: chains:: Chain ;
36+ use masq_lib:: constants:: DEFAULT_MAX_BLOCK_COUNT ;
3637use masq_lib:: logger:: Logger ;
3738use masq_lib:: messages:: ScanType ;
3839use masq_lib:: ui_gateway:: NodeFromUiMessage ;
@@ -287,7 +288,7 @@ impl BlockchainBridge {
287288 } ;
288289 let max_block_count = match self . persistent_config . max_block_count ( ) {
289290 Ok ( Some ( mbc) ) => mbc,
290- _ => u64 :: MAX ,
291+ _ => DEFAULT_MAX_BLOCK_COUNT ,
291292 } ;
292293 let use_unlimited_block_count_range = u64:: MAX == max_block_count;
293294 let use_latest_block = u64:: MAX == start_block_nbr;
@@ -1019,7 +1020,7 @@ mod tests {
10191020 ) ) )
10201021 . lower_interface_results ( Box :: new ( lower_interface) ) ;
10211022 let persistent_config = PersistentConfigurationMock :: new ( )
1022- . max_block_count_result ( Ok ( Some ( 100_000 ) ) )
1023+ . max_block_count_result ( Ok ( Some ( DEFAULT_MAX_BLOCK_COUNT ) ) )
10231024 . start_block_result ( Ok ( Some ( 5 ) ) ) ; // no set_start_block_result: set_start_block() must not be called
10241025 let mut subject = BlockchainBridge :: new (
10251026 Box :: new ( blockchain_interface) ,
@@ -1277,11 +1278,11 @@ mod tests {
12771278 }
12781279
12791280 #[ test]
1280- fn handle_retrieve_transactions_uses_latest_block_number_upon_get_block_number_error ( ) {
1281+ fn handle_retrieve_transactions_uses_default_max_block_count_for_ending_block_number_upon_get_block_number_error ( ) {
12811282 init_test_logging ( ) ;
12821283 let retrieve_transactions_params_arc = Arc :: new ( Mutex :: new ( vec ! [ ] ) ) ;
12831284 let system = System :: new (
1284- "handle_retrieve_transactions_uses_latest_block_number_upon_get_block_number_error " ,
1285+ "handle_retrieve_transactions_uses_default_max_block_count_for_ending_block_number_upon_get_block_number_error " ,
12851286 ) ;
12861287 let ( accountant, _, accountant_recording_arc) = make_recorder ( ) ;
12871288 let earning_wallet = make_wallet ( "somewallet" ) ;
@@ -1311,7 +1312,7 @@ mod tests {
13111312 . retrieve_transactions_result ( Ok ( expected_transactions. clone ( ) ) )
13121313 . lower_interface_results ( Box :: new ( lower_interface) ) ;
13131314 let persistent_config = PersistentConfigurationMock :: new ( )
1314- . max_block_count_result ( Ok ( None ) )
1315+ . max_block_count_result ( Ok ( Some ( DEFAULT_MAX_BLOCK_COUNT ) ) )
13151316 . start_block_result ( Ok ( Some ( 6 ) ) ) ;
13161317 let subject = BlockchainBridge :: new (
13171318 Box :: new ( blockchain_interface_mock) ,
@@ -1341,7 +1342,7 @@ mod tests {
13411342 * retrieve_transactions_params,
13421343 vec![ (
13431344 BlockNumber :: Number ( 6u64 . into( ) ) ,
1344- BlockNumber :: Latest ,
1345+ BlockNumber :: Number ( ( DEFAULT_MAX_BLOCK_COUNT + 6u64 ) . into ( ) ) ,
13451346 earning_wallet
13461347 ) ]
13471348 ) ;
@@ -1361,7 +1362,7 @@ mod tests {
13611362 } ) ,
13621363 }
13631364 ) ;
1364- TestLogHandler :: new ( ) . exists_log_containing ( "DEBUG: BlockchainBridge: Using 'latest' block number instead of a literal number. QueryFailed(\" Failed to read the latest block number\" )" ) ;
1365+ TestLogHandler :: new ( ) . exists_log_containing ( "DEBUG: BlockchainBridge: Using '100006' ending block number. QueryFailed(\" Failed to read the latest block number\" )" ) ;
13651366 }
13661367
13671368 #[ test]
@@ -1400,7 +1401,7 @@ mod tests {
14001401 . retrieve_transactions_result ( Ok ( expected_transactions. clone ( ) ) )
14011402 . lower_interface_results ( Box :: new ( lower_interface) ) ;
14021403 let persistent_config = PersistentConfigurationMock :: new ( )
1403- . max_block_count_result ( Ok ( None ) )
1404+ . max_block_count_result ( Ok ( Some ( DEFAULT_MAX_BLOCK_COUNT ) ) )
14041405 . start_block_result ( Ok ( None ) ) ;
14051406 let subject = BlockchainBridge :: new (
14061407 Box :: new ( blockchain_interface_mock) ,
@@ -1449,7 +1450,7 @@ mod tests {
14491450 }
14501451
14511452 #[ test]
1452- fn handle_retrieve_transactions_with_latest_for_start_and_end_block_is_supported ( ) {
1453+ fn handle_retrieve_transactions_when_get_block_number_fails_uses_latest_for_start_and_end_block ( ) {
14531454 let retrieve_transactions_params_arc = Arc :: new ( Mutex :: new ( vec ! [ ] ) ) ;
14541455 let earning_wallet = make_wallet ( "somewallet" ) ;
14551456 let amount = 42 ;
@@ -1471,11 +1472,11 @@ mod tests {
14711472 } ;
14721473
14731474 let system = System :: new (
1474- "handle_retrieve_transactions_with_latest_for_start_and_end_block_is_supported " ,
1475+ "handle_retrieve_transactions_when_get_block_number_fails_uses_latest_for_start_and_end_block " ,
14751476 ) ;
14761477 let ( accountant, _, accountant_recording_arc) = make_recorder ( ) ;
14771478 let persistent_config = PersistentConfigurationMock :: new ( )
1478- . max_block_count_result ( Ok ( None ) )
1479+ . max_block_count_result ( Ok ( Some ( DEFAULT_MAX_BLOCK_COUNT ) ) )
14791480 . start_block_result ( Ok ( None ) ) ;
14801481 let latest_block_number = LatestBlockNumber :: Err ( BlockchainError :: QueryFailed (
14811482 "Failed to read from block chain service" . to_string ( ) ,
0 commit comments