Skip to content

Commit

Permalink
feat(p2pool-randomx-support): merge mining proxy update (#6521)
Browse files Browse the repository at this point in the history
Description
---
Add missing parameters for merge mining proxy to use p2pool.

Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

---------

Co-authored-by: SW van Heerden <[email protected]>
  • Loading branch information
ksrichard and SWvheerden authored Sep 4, 2024
1 parent 31a953c commit 3f4a3e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
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

0 comments on commit 3f4a3e8

Please sign in to comment.