@@ -429,7 +429,7 @@ async fn estimate_compute_unit_price_micro_lamports(
429
429
)
430
430
) ]
431
431
pub async fn publish_batches < S > (
432
- state : & S ,
432
+ state : Arc < S > ,
433
433
client : Arc < RpcClient > ,
434
434
network : Network ,
435
435
network_state_rx : & watch:: Receiver < NetworkState > ,
@@ -466,7 +466,7 @@ where
466
466
let network_state = * network_state_rx. borrow ( ) ;
467
467
for batch in batches {
468
468
batch_futures. push ( publish_batch (
469
- state,
469
+ state. clone ( ) ,
470
470
client. clone ( ) ,
471
471
network,
472
472
network_state,
@@ -494,7 +494,7 @@ where
494
494
. into_iter ( )
495
495
. collect :: < Result < Vec < _ > > > ( ) ?;
496
496
497
- Exporter :: record_publish ( state, batch_state) . await ;
497
+ Exporter :: record_publish ( & * state, batch_state) . await ;
498
498
Ok ( ( ) )
499
499
}
500
500
@@ -509,7 +509,7 @@ where
509
509
)
510
510
) ]
511
511
async fn publish_batch < S > (
512
- state : & S ,
512
+ state : Arc < S > ,
513
513
client : Arc < RpcClient > ,
514
514
network : Network ,
515
515
network_state : NetworkState ,
@@ -535,7 +535,7 @@ where
535
535
let mut instructions = Vec :: new ( ) ;
536
536
537
537
// Refresh the data in the batch
538
- let local_store_contents = LocalStore :: get_all_price_infos ( state) . await ;
538
+ let local_store_contents = LocalStore :: get_all_price_infos ( & * state) . await ;
539
539
let refreshed_batch = batch. iter ( ) . map ( |( identifier, _) | {
540
540
(
541
541
identifier,
@@ -615,7 +615,7 @@ where
615
615
// Use the estimated previous price if it is higher
616
616
// than the current price.
617
617
let recent_compute_unit_price_micro_lamports =
618
- Exporter :: get_recent_compute_unit_price_micro_lamports ( state) . await ;
618
+ Exporter :: get_recent_compute_unit_price_micro_lamports ( & * state) . await ;
619
619
620
620
if let Some ( estimated_recent_price) = recent_compute_unit_price_micro_lamports {
621
621
// Get the estimated compute unit price and wrap it so it stays below the maximum
@@ -633,7 +633,7 @@ where
633
633
// in this batch. This will use the maximum total compute unit fee if the publisher
634
634
// hasn't updated for >= MAXIMUM_SLOT_GAP_FOR_DYNAMIC_COMPUTE_UNIT_PRICE slots.
635
635
let result = GlobalStore :: price_accounts (
636
- state,
636
+ & * state,
637
637
network,
638
638
price_accounts. clone ( ) . into_iter ( ) . collect ( ) ,
639
639
)
@@ -697,31 +697,33 @@ where
697
697
network_state. blockhash ,
698
698
) ;
699
699
700
- let signature = match client
701
- . send_transaction_with_config (
702
- & transaction,
703
- RpcSendTransactionConfig {
704
- skip_preflight : true ,
705
- ..RpcSendTransactionConfig :: default ( )
706
- } ,
707
- )
708
- . await
709
- {
710
- Ok ( signature) => signature,
711
- Err ( err) => {
712
- tracing:: error!( err = ?err, "Exporter: failed to send transaction." ) ;
713
- return Ok ( ( ) ) ;
714
- }
715
- } ;
700
+ tokio:: spawn ( async move {
701
+ let signature = match client
702
+ . send_transaction_with_config (
703
+ & transaction,
704
+ RpcSendTransactionConfig {
705
+ skip_preflight : true ,
706
+ ..RpcSendTransactionConfig :: default ( )
707
+ } ,
708
+ )
709
+ . await
710
+ {
711
+ Ok ( signature) => signature,
712
+ Err ( err) => {
713
+ tracing:: error!( err = ?err, "Exporter: failed to send transaction." ) ;
714
+ return ;
715
+ }
716
+ } ;
716
717
717
- tracing:: debug!(
718
- signature = signature. to_string( ) ,
719
- instructions = instructions. len( ) ,
720
- price_accounts = ?price_accounts,
721
- "Sent upd_price transaction." ,
722
- ) ;
718
+ tracing:: debug!(
719
+ signature = signature. to_string( ) ,
720
+ instructions = instructions. len( ) ,
721
+ price_accounts = ?price_accounts,
722
+ "Sent upd_price transaction." ,
723
+ ) ;
723
724
724
- Transactions :: add_transaction ( state, signature) . await ;
725
+ Transactions :: add_transaction ( & * state, signature) . await ;
726
+ } ) ;
725
727
726
728
Ok ( ( ) )
727
729
}
0 commit comments