@@ -2,11 +2,7 @@ use self::boosted_hex_eligibility::BoostedHexEligibility;
2
2
use crate :: {
3
3
boosting_oracles:: db:: check_for_unprocessed_data_sets,
4
4
coverage, data_session,
5
- heartbeats:: {
6
- self ,
7
- location_cache:: { self , LocationCache } ,
8
- HeartbeatReward ,
9
- } ,
5
+ heartbeats:: { self , location_cache:: LocationCache , HeartbeatReward } ,
10
6
radio_location_estimates, radio_threshold,
11
7
reward_shares:: {
12
8
self , CalculatedPocRewardShares , CoverageShares , DataTransferAndPocAllocatedRewardBuckets ,
@@ -25,7 +21,6 @@ use file_store::{
25
21
traits:: { FileSinkCommitStrategy , FileSinkRollTime , FileSinkWriteExt , TimestampEncode } ,
26
22
} ;
27
23
use futures_util:: TryFutureExt ;
28
- use h3o:: { LatLng , Resolution } ;
29
24
use helium_proto:: {
30
25
reward_manifest:: RewardData :: MobileRewardData ,
31
26
services:: poc_mobile:: {
@@ -433,7 +428,7 @@ async fn reward_poc(
433
428
speedtest_avg_sink : & FileSinkClient < proto:: SpeedtestAvg > ,
434
429
reward_period : & Range < DateTime < Utc > > ,
435
430
reward_shares : DataTransferAndPocAllocatedRewardBuckets ,
436
- location_cache : & LocationCache ,
431
+ _location_cache : & LocationCache ,
437
432
) -> anyhow:: Result < ( Decimal , CalculatedPocRewardShares ) > {
438
433
let heartbeats = HeartbeatReward :: validated ( pool, reward_period) ;
439
434
let speedtest_averages =
@@ -460,30 +455,6 @@ async fn reward_poc(
460
455
)
461
456
. await ?;
462
457
463
- {
464
- // TODO: Maybe we should hydrate cache on start to avoid banning too many hotspot
465
- let locations = location_cache. get_all ( ) . await ;
466
- for ( key, value) in locations. iter ( ) {
467
- let entity = location_cache:: key_to_entity ( key. clone ( ) ) ;
468
- // Estimates are ordered by bigger radius first it should allow us to do less calculation
469
- // and find a match faster
470
- let estimates =
471
- radio_location_estimates:: get_valid_estimates ( pool, & entity, dec ! ( 0.75 ) ) . await ?;
472
- if estimates. is_empty ( ) {
473
- // TODO we ban that key
474
- todo ! ( )
475
- } else {
476
- match is_within_radius ( value. lat , value. lon , estimates) {
477
- Ok ( true ) => todo ! ( ) ,
478
- // TODO we ban that key
479
- Ok ( false ) => todo ! ( ) ,
480
- // TODO we ban that key
481
- Err ( _) => todo ! ( ) ,
482
- }
483
- }
484
- }
485
- }
486
-
487
458
let coverage_shares = CoverageShares :: new (
488
459
pool,
489
460
heartbeats,
@@ -530,46 +501,6 @@ async fn reward_poc(
530
501
Ok ( ( unallocated_poc_amount, calculated_poc_rewards_per_share) )
531
502
}
532
503
533
- fn is_within_radius (
534
- loc_lat : f64 ,
535
- loc_lon : f64 ,
536
- estimates : Vec < ( Decimal , Decimal , Decimal ) > ,
537
- ) -> anyhow:: Result < bool > {
538
- let resolution = Resolution :: Twelve ;
539
-
540
- let point_a = LatLng :: new ( loc_lat, loc_lon)
541
- . map_err ( |e| anyhow:: anyhow!( "Invalid LatLng for A: {}" , e) ) ?;
542
- let h3_index_a = point_a. to_cell ( resolution) ;
543
-
544
- for ( radius_meters, lat, lon) in estimates {
545
- let lat_f64 = lat
546
- . to_f64 ( )
547
- . ok_or_else ( || anyhow:: anyhow!( "Failed to convert lat_b to f64" ) ) ?;
548
- let lon_f64 = lon
549
- . to_f64 ( )
550
- . ok_or_else ( || anyhow:: anyhow!( "Failed to convert lon_b to f64" ) ) ?;
551
- let radius_meters_f64 = radius_meters
552
- . to_f64 ( )
553
- . ok_or_else ( || anyhow:: anyhow!( "Failed to convert radius_meters to f64" ) ) ?;
554
-
555
- let point_b = LatLng :: new ( lat_f64, lon_f64)
556
- . map_err ( |e| anyhow:: anyhow!( "Invalid LatLng for B: {}" , e) ) ?;
557
- let h3_index_b = point_b. to_cell ( resolution) ;
558
-
559
- let grid_distance = h3_index_a
560
- . grid_distance ( h3_index_b)
561
- . map_err ( |e| anyhow:: anyhow!( "Failed to calculate grid distance: {}" , e) ) ?;
562
-
563
- let max_grid_distance = ( radius_meters_f64 / 9.0 ) . round ( ) as i32 ;
564
-
565
- if grid_distance <= max_grid_distance {
566
- return Ok ( true ) ;
567
- }
568
- }
569
-
570
- Ok ( false )
571
- }
572
-
573
504
pub async fn reward_dc (
574
505
mobile_rewards : & FileSinkClient < proto:: MobileRewardShare > ,
575
506
reward_period : & Range < DateTime < Utc > > ,
0 commit comments