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

feat(p2pool-randomx-support): merge mining proxy update #6521

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use std::{cmp, convert::TryFrom, sync::Arc};

use log::*;
use minotari_app_grpc::tari_rpc::{GetNewBlockRequest, MinerData, NewBlockTemplate};
use minotari_app_grpc::tari_rpc::{pow_algo::PowAlgos, GetNewBlockRequest, MinerData, NewBlockTemplate, PowAlgo};
use minotari_app_utilities::parse_miner_input::{BaseNodeGrpcClient, ShaP2PoolGrpcClient};
use minotari_node_grpc_client::grpc;
use tari_common_types::{tari_address::TariAddress, types::FixedHash};
Expand Down Expand Up @@ -130,7 +130,13 @@ impl BlockTemplateProtocol<'_> {
} else {
let block = match self.p2pool_client.as_mut() {
Some(client) => {
let block_result = client.get_new_block(GetNewBlockRequest::default()).await?.into_inner();
let pow_algo = PowAlgo {
pow_algo: PowAlgos::Randomx.into(),
};
let block_result = client
.get_new_block(GetNewBlockRequest { pow: Some(pow_algo) })
.await?
.into_inner();
block_result
.block
.ok_or_else(|| MmProxyError::FailedToGetBlockTemplate("block result".to_string()))?
Expand Down
3 changes: 3 additions & 0 deletions applications/minotari_merge_mining_proxy/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ pub struct MergeMiningProxyConfig {
pub monerod_use_auth: bool,
/// The Minotari base node's GRPC address
pub base_node_grpc_address: Option<Multiaddr>,
/// P2Pool node's gRPC address
pub p2pool_node_grpc_address: Option<Multiaddr>,
/// GRPC authentication for base node
pub base_node_grpc_authentication: GrpcAuthentication,
/// GRPC domain name for node TLS validation
Expand Down Expand Up @@ -107,6 +109,7 @@ impl Default for MergeMiningProxyConfig {
monerod_password: String::new(),
monerod_use_auth: false,
base_node_grpc_address: None,
p2pool_node_grpc_address: None,
base_node_grpc_authentication: GrpcAuthentication::default(),
base_node_grpc_tls_domain_name: None,
base_node_grpc_ca_cert_filename: "node_ca.pem".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async fn connect_base_node(config: &MergeMiningProxyConfig) -> Result<BaseNodeGr

async fn connect_sha_p2pool(config: &MergeMiningProxyConfig) -> Result<ShaP2PoolGrpcClient, MmProxyError> {
// TODO: Merge this code in the sha miner
let socketaddr = base_node_socket_address(config.base_node_grpc_address.clone(), config.network)?;
let socketaddr = base_node_socket_address(config.p2pool_node_grpc_address.clone(), config.network)?;
let base_node_addr = format!(
"{}{}",
protocol_string(config.base_node_grpc_tls_domain_name.is_some()),
Expand Down
Loading