Skip to content

Commit

Permalink
f jd-server
Browse files Browse the repository at this point in the history
  • Loading branch information
jbesraa committed Aug 9, 2024
1 parent 9eb1b23 commit a3f154b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
13 changes: 8 additions & 5 deletions roles/jd-server/src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ use job_declarator::JobDeclarator;
use key_utils::{Secp256k1PublicKey, Secp256k1SecretKey};
use mempool::error::JdsMempoolError;
use roles_logic_sv2::{
errors::Error, parsers::PoolMessages as JdsMessages, utils::{CoinbaseOutput as CoinbaseOutput_, Mutex},
errors::Error,
parsers::PoolMessages as JdsMessages,
utils::{CoinbaseOutput as CoinbaseOutput_, Mutex},
};
use serde::Deserialize;
use tracing::warn;
use std::{
convert::{TryFrom, TryInto}, ops::Sub, sync::Arc, time::Duration
convert::{TryFrom, TryInto},
ops::Sub,
sync::Arc,
time::Duration,
};
use stratum_common::bitcoin::{Script, TxOut};
use tracing::warn;

pub type Message = JdsMessages<'static>;
pub type StdFrame = StandardSv2Frame<Message>;
Expand All @@ -39,7 +44,6 @@ pub fn get_coinbase_output(config: &Configuration) -> Result<Vec<TxOut>, Error>
}
}


pub fn start_jd_server(config: Configuration) -> Receiver<status::Status> {
let url = config.core_rpc_url.clone() + ":" + &config.core_rpc_port.clone().to_string();
let username = config.core_rpc_user.clone();
Expand Down Expand Up @@ -187,7 +191,6 @@ impl CoinbaseOutput {
}
}


#[derive(Debug, Deserialize, Clone)]
pub struct Configuration {
#[serde(default = "default_true")]
Expand Down
48 changes: 24 additions & 24 deletions roles/jd-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,31 +162,31 @@ async fn main() {
// }
// });

// let mempool_cloned = mempool.clone();
// let mempool_cloned = mempool.clone();

// let sender_submit_solution = sender.clone();
// task::spawn(async move {
// loop {
// let result = mempool::JDsMempool::on_submit(mempool_cloned.clone()).await;
// if let Err(err) = result {
// match err {
// JdsMempoolError::EmptyMempool => {
// if last_empty_mempool_warning.elapsed().as_secs() >= 60 {
// warn!("{:?}", err);
// warn!("Template Provider is running, but its mempool is empty (possible reasons: you're testing in testnet, signet, or regtest)");
// last_empty_mempool_warning = std::time::Instant::now();
// }
// }
// _ => {
// // TODO here there should be a better error managmenet
// mempool::error::handle_error(&err);
// handle_result!(sender_submit_solution, Err(err));
// }
// }
// }
// }
// });
// };
// let sender_submit_solution = sender.clone();
// task::spawn(async move {
// loop {
// let result = mempool::JDsMempool::on_submit(mempool_cloned.clone()).await;
// if let Err(err) = result {
// match err {
// JdsMempoolError::EmptyMempool => {
// if last_empty_mempool_warning.elapsed().as_secs() >= 60 {
// warn!("{:?}", err);
// warn!("Template Provider is running, but its mempool is empty (possible reasons: you're testing in testnet, signet, or regtest)");
// last_empty_mempool_warning = std::time::Instant::now();
// }
// }
// _ => {
// // TODO here there should be a better error managmenet
// mempool::error::handle_error(&err);
// handle_result!(sender_submit_solution, Err(err));
// }
// }
// }
// }
// });
// };

// info!("Jds INITIALIZING with config: {:?}", &args.config_path);

Expand Down

0 comments on commit a3f154b

Please sign in to comment.