Skip to content

Commit

Permalink
Move RewardsRecorderService from solana-core to solana-rpc (#3953)
Browse files Browse the repository at this point in the history
RewardsRecorderService is only created when a node is running with RPC
flags (--rpc-enable-transaction-history)
  • Loading branch information
steviez authored Dec 6, 2024
1 parent 0b2ed16 commit 783d387
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub mod poh_timing_reporter;
pub mod repair;
pub mod replay_stage;
mod result;
pub mod rewards_recorder_service;
pub mod sample_performance_service;
mod shred_fetch_stage;
pub mod sigverify;
Expand Down
2 changes: 1 addition & 1 deletion core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use {
serve_repair::ServeRepair,
serve_repair_service::ServeRepairService,
},
rewards_recorder_service::RewardsRecorderService,
sample_performance_service::SamplePerformanceService,
sigverify,
snapshot_packager_service::{PendingSnapshotPackages, SnapshotPackagerService},
Expand Down Expand Up @@ -88,6 +87,7 @@ use {
BankNotificationSenderConfig, OptimisticallyConfirmedBank,
OptimisticallyConfirmedBankTracker,
},
rewards_recorder_service::RewardsRecorderService,
rpc::JsonRpcConfig,
rpc_completed_slots_service::RpcCompletedSlotsService,
rpc_pubsub_service::{PubSubConfig, PubSubService},
Expand Down
6 changes: 4 additions & 2 deletions ledger-tool/src/ledger_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use {
},
solana_core::{
accounts_hash_verifier::AccountsHashVerifier,
rewards_recorder_service::RewardsRecorderService,
snapshot_packager_service::PendingSnapshotPackages, validator::BlockVerificationMethod,
},
solana_geyser_plugin_manager::geyser_plugin_service::{
Expand All @@ -27,7 +26,10 @@ use {
use_snapshot_archives_at_startup::UseSnapshotArchivesAtStartup,
},
solana_measure::measure_time,
solana_rpc::transaction_status_service::TransactionStatusService,
solana_rpc::{
rewards_recorder_service::RewardsRecorderService,
transaction_status_service::TransactionStatusService,
},
solana_runtime::{
accounts_background_service::{
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService,
Expand Down
1 change: 1 addition & 0 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod filter;
pub mod max_slots;
pub mod optimistically_confirmed_bank_tracker;
pub mod parsed_token_accounts;
pub mod rewards_recorder_service;
pub mod rpc;
mod rpc_cache;
pub mod rpc_completed_slots_service;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! The `RewardsRecorderService` is responsible for receiving rewards data and
//! persisting it into the `Blockstore`.
use {
crossbeam_channel::RecvTimeoutError,
solana_ledger::{
Expand Down Expand Up @@ -29,15 +32,21 @@ impl RewardsRecorderService {
) -> Self {
let thread_hdl = Builder::new()
.name("solRewardsWritr".to_string())
.spawn(move || loop {
if exit.load(Ordering::Relaxed) {
break;
}
if let Err(RecvTimeoutError::Disconnected) =
Self::write_rewards(&rewards_receiver, &max_complete_rewards_slot, &blockstore)
{
break;
.spawn(move || {
info!("RewardsRecorderService has started");
loop {
if exit.load(Ordering::Relaxed) {
break;
}
if let Err(RecvTimeoutError::Disconnected) = Self::write_rewards(
&rewards_receiver,
&max_complete_rewards_slot,
&blockstore,
) {
break;
}
}
info!("RewardsRecorderService has stopped");
})
.unwrap();
Self { thread_hdl }
Expand Down

0 comments on commit 783d387

Please sign in to comment.