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: add monerod detection as an option to the merge mining proxy #6248

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
353 changes: 341 additions & 12 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions applications/minotari_merge_mining_proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ tokio = { version = "1.36", features = ["macros"] }
tonic = "0.8.3"
tracing = "0.1"
url = "2.1.1"
scraper = "0.19.0"

[build-dependencies]
tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.11a"}

[dev-dependencies]
markup5ever = "0.11.0"
13 changes: 12 additions & 1 deletion applications/minotari_merge_mining_proxy/log4rs_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,15 @@ loggers:
- stdout
- proxy
additive: false

html5ever:
level: error
appenders:
- stdout
- proxy
additive: false
selectors:
level: error
appenders:
- stdout
- proxy
additive: false
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

//! Provides methods for for building template data and storing them with timestamps.
//! Provides methods for building template data and storing them with timestamps.

use std::{collections::HashMap, convert::TryFrom, sync::Arc};

Expand Down
15 changes: 14 additions & 1 deletion applications/minotari_merge_mining_proxy/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,23 @@ use tari_common_types::tari_address::TariAddress;
use tari_comms::multiaddr::Multiaddr;
use tari_core::transactions::transaction_components::RangeProofType;

// The default Monero fail URL for mainnet
const MONERO_FAIL_MAINNET_URL: &str = "https://monero.fail/?chain=monero&network=mainnet&all=true";

#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
#[allow(clippy::struct_excessive_bools)]
pub struct MergeMiningProxyConfig {
override_from: Option<String>,
/// URL to monerod
/// Use dynamic monerod URL obtained form the official Monero website (https://monero.fail/)
pub use_dynamic_fail_data: bool,
/// The monero fail URL to get the monerod URLs from - must be pointing to the official Monero website.
/// Valid alternatives are:
/// - mainnet: 'https://monero.fail/?chain=monero&network=mainnet&all=true'
/// - stagenet: `https://monero.fail/?chain=monero&network=stagenet&all=true`
/// - testnet: `https://monero.fail/?chain=monero&network=testnet&all=true`
pub monero_fail_url: String,
/// URL to monerod (you can add your own server here or use public nodes from https://monero.fail/)
pub monerod_url: StringList,
/// Username for curl
pub monerod_username: String,
Expand Down Expand Up @@ -89,6 +100,8 @@ impl Default for MergeMiningProxyConfig {
fn default() -> Self {
Self {
override_from: None,
use_dynamic_fail_data: true,
monero_fail_url: MONERO_FAIL_MAINNET_URL.into(),
monerod_url: StringList::default(),
monerod_username: String::new(),
monerod_password: String::new(),
Expand Down
2 changes: 2 additions & 0 deletions applications/minotari_merge_mining_proxy/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ pub enum MmProxyError {
},
#[error("HTTP error: {0}")]
HttpError(#[from] hyper::http::Error),
#[error("HTML parse error: {0}")]
HtmlParseError(String),
#[error("Could not parse URL: {0}")]
UrlParseError(#[from] url::ParseError),
#[error("Bincode error: {0}")]
Expand Down
1 change: 1 addition & 0 deletions applications/minotari_merge_mining_proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mod error;
mod proxy;
mod run_merge_miner;
use run_merge_miner::start_merge_miner;
mod monero_fail;

pub async fn merge_miner(cli: Cli) -> Result<(), anyhow::Error> {
start_merge_miner(cli).await
Expand Down
1 change: 1 addition & 0 deletions applications/minotari_merge_mining_proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ mod cli;
mod common;
mod config;
mod error;
mod monero_fail;
mod proxy;
mod run_merge_miner;

Expand Down
Loading
Loading