Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove solana balance monitor #649

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions iot_packet_verifier/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use file_store::{
};
use futures_util::TryFutureExt;
use iot_config::client::OrgClient;
use solana::{balance_monitor::BalanceMonitor, SolanaRpc};
use solana::SolanaRpc;
use sqlx::{Pool, Postgres};
use std::{sync::Arc, time::Duration};
use task_manager::{ManagedTask, TaskManager};
Expand Down Expand Up @@ -107,15 +107,6 @@ impl Cmd {
None
};

let sol_balance_monitor = BalanceMonitor::new(
solana.clone(),
settings
.solana
.as_ref()
.map(|s| s.additional_sol_balances_to_monitor())
.unwrap_or_else(|| Ok(Vec::new()))?,
)?;

// Set up the balance cache:
let balances = BalanceCache::new(&mut pool.clone(), solana.clone()).await?;

Expand Down Expand Up @@ -200,7 +191,6 @@ impl Cmd {
.map_err(anyhow::Error::from)
})
.add_task(verifier_daemon)
.add_task(sol_balance_monitor)
.add_task(burner)
.add_task(report_files_server)
.start()
Expand Down
12 changes: 0 additions & 12 deletions mobile_packet_verifier/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ impl Cmd {
None
};

let sol_balance_monitor = solana::balance_monitor::BalanceMonitor::new(
solana.clone(),
settings
.solana
.as_ref()
.map(|s| s.additional_sol_balances_to_monitor())
.unwrap_or_else(|| Ok(Vec::new()))?,
)?;

let (file_upload_tx, file_upload_rx) = file_upload::message_channel();
let file_upload =
file_upload::FileUpload::from_settings(&settings.output, file_upload_rx).await?;
Expand Down Expand Up @@ -191,9 +182,6 @@ impl Cmd {
.run(shutdown_listener.clone())
.map_err(Error::from),
daemon.run(&shutdown_listener).map_err(Error::from),
sol_balance_monitor
.run(shutdown_listener.clone())
.map_err(Error::from),
event_id_purger.run(shutdown_listener.clone()),
)?;

Expand Down
81 changes: 0 additions & 81 deletions solana/src/balance_monitor.rs

This file was deleted.

13 changes: 0 additions & 13 deletions solana/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pub mod balance_monitor;

use anchor_client::{RequestBuilder, RequestNamespace};
use anchor_lang::AccountDeserialize;
use async_trait::async_trait;
Expand Down Expand Up @@ -73,7 +71,6 @@ pub struct Settings {
dnt_mint: String,
#[serde(default)]
payers_to_monitor: Vec<String>,
additional_sol_balances_to_monitor: Vec<String>,
}

impl Settings {
Expand All @@ -84,16 +81,6 @@ impl Settings {
.collect::<Result<_, _>>()
.map_err(SolanaRpcError::from)
}

pub fn additional_sol_balances_to_monitor(
&self,
) -> Result<Vec<solana_sdk::pubkey::Pubkey>, SolanaRpcError> {
self.additional_sol_balances_to_monitor
.iter()
.map(|pubkey_string| Pubkey::from_str(pubkey_string))
.collect::<Result<Vec<Pubkey>, ParsePubkeyError>>()
.map_err(SolanaRpcError::from)
}
}

pub struct SolanaRpc {
Expand Down