@@ -70,11 +70,11 @@ impl From<SolanaPriceAccount> for PriceEntry {
7070 fn from ( other : SolanaPriceAccount ) -> PriceEntry {
7171 unsafe {
7272 // NOTE: We know the size is 32 because It's a Solana account. This is for tests only.
73- let comp_mem = std:: slice:: from_raw_parts ( other. comp . as_ptr ( ) as * const PriceComp , 32 ) ;
73+ let comp_mem = std:: slice:: from_raw_parts ( other. comp . as_ptr ( ) , 32 ) ;
7474 let account =
7575 * ( & other as * const SolanaPriceAccount as * const GenericPriceAccount < 0 , ( ) > ) ;
7676 let mut comp = [ PriceComp :: default ( ) ; 64 ] ;
77- ( & mut comp[ 0 ..32 ] ) . copy_from_slice ( comp_mem) ;
77+ comp[ 0 ..32 ] . copy_from_slice ( comp_mem) ;
7878 PriceEntry { account, comp }
7979 }
8080 }
@@ -90,12 +90,15 @@ impl PriceEntry {
9090 _ => return None ,
9191 } ;
9292
93- let account = * ( acc . as_ptr ( ) as * const GenericPriceAccount < 0 , ( ) > ) ;
94- let comp_mem =
95- std:: slice:: from_raw_parts ( account . comp . as_ptr ( ) as * const PriceComp , size) ;
93+ // Getting a pointer to avoid copying the account
94+ let account_ptr = & * ( acc . as_ptr ( ) as * const GenericPriceAccount < 0 , ( ) > ) ;
95+ let comp_mem = std:: slice:: from_raw_parts ( account_ptr . comp . as_ptr ( ) , size) ;
9696 let mut comp = [ PriceComp :: default ( ) ; 64 ] ;
97- ( & mut comp[ 0 ..size] ) . copy_from_slice ( comp_mem) ;
98- Some ( Self { account, comp } )
97+ comp[ 0 ..size] . copy_from_slice ( comp_mem) ;
98+ Some ( Self {
99+ account : * account_ptr,
100+ comp,
101+ } )
99102 }
100103 }
101104}
@@ -321,10 +324,10 @@ impl Oracle {
321324 . collect :: < HashSet < _ > > ( ) ;
322325 let new_publishers = data. publisher_permissions . keys ( ) . collect :: < HashSet < _ > > ( ) ;
323326 info ! (
324- self . logger,
325- "updated publisher permissions" ;
326- "new_publishers" => format!( "{:?}" , new_publishers. difference( & previous_publishers) . collect:: <HashSet <_>>( ) ) ,
327- "total_publishers" => new_publishers. len( ) ,
327+ self . logger,
328+ "updated publisher permissions" ;
329+ "new_publishers" => format!( "{:?}" , new_publishers. difference( & previous_publishers) . collect:: <HashSet <_>>( ) ) ,
330+ "total_publishers" => new_publishers. len( ) ,
328331 ) ;
329332
330333 // Update the data with the new data structs
@@ -499,6 +502,10 @@ impl Poller {
499502
500503 for ( price_key, price_entry) in price_accounts. iter ( ) {
501504 for component in price_entry. comp {
505+ if component. publisher == Pubkey :: default ( ) {
506+ continue ;
507+ }
508+
502509 let component_pub_entry = publisher_permissions
503510 . entry ( component. publisher )
504511 . or_insert ( HashMap :: new ( ) ) ;
@@ -607,16 +614,15 @@ impl Poller {
607614 product. iter ( ) . find ( |( k, _v) | * k == "weekly_schedule" )
608615 {
609616 wsched_val. parse ( ) . unwrap_or_else ( |err| {
610- warn ! (
611- self . logger,
612- "Oracle: Product has weekly_schedule defined but it could not be parsed. Falling back to 24/7 publishing." ;
613- "product_key" => product_key. to_string( ) ,
614- "weekly_schedule" => wsched_val,
615- ) ;
616- debug ! ( self . logger, "parsing error context" ; "context" => format!( "{:?}" , err) ) ;
617- Default :: default ( )
618- }
619- )
617+ warn ! (
618+ self . logger,
619+ "Oracle: Product has weekly_schedule defined but it could not be parsed. Falling back to 24/7 publishing." ;
620+ "product_key" => product_key. to_string( ) ,
621+ "weekly_schedule" => wsched_val,
622+ ) ;
623+ debug ! ( self . logger, "parsing error context" ; "context" => format!( "{:?}" , err) ) ;
624+ Default :: default ( )
625+ } )
620626 } else {
621627 Default :: default ( ) // No market hours specified, meaning 24/7 publishing
622628 } ;
@@ -662,6 +668,8 @@ impl Poller {
662668 let price = PriceEntry :: load_from_account ( & price_acc. data )
663669 . context ( format ! ( "Could not parse price account at {}" , price_key) ) ?;
664670
671+ debug ! ( self . logger, "Oracle: Fetched price {:?}" , price) ;
672+
665673 let next_price = price. next ;
666674 if let Some ( prod) = product_entries. get_mut ( & price. prod ) {
667675 prod. price_accounts . push ( * price_key) ;
0 commit comments