Skip to content

Commit

Permalink
Add monerod detection
Browse files Browse the repository at this point in the history
Added dynamic and robust monerod detection to the merge mining proxy,
in addition to the monerod URLs specified in the config.
  • Loading branch information
hansieodendaal committed Apr 4, 2024
1 parent b48a830 commit 3469b71
Show file tree
Hide file tree
Showing 13 changed files with 730 additions and 31 deletions.
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
5 changes: 4 additions & 1 deletion applications/minotari_merge_mining_proxy/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use tari_core::transactions::transaction_components::RangeProofType;
#[allow(clippy::struct_excessive_bools)]
pub struct MergeMiningProxyConfig {
override_from: Option<String>,
/// URL to monerod
/// 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 @@ -83,6 +83,8 @@ pub struct MergeMiningProxyConfig {
pub stealth_payment: bool,
/// Range proof type - revealed_value or bullet_proof_plus: (default = revealed_value)
pub range_proof_type: RangeProofType,
/// Use dynamic monerod URL obtained form the official Monero website (https://monero.fail/)
pub use_dynamic_monerod_url: bool,
}

impl Default for MergeMiningProxyConfig {
Expand All @@ -108,6 +110,7 @@ impl Default for MergeMiningProxyConfig {
wallet_payment_address: TariAddress::default().to_hex(),
stealth_payment: true,
range_proof_type: RangeProofType::RevealedValue,
use_dynamic_monerod_url: true,
}
}
}
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("Grpc authentication 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 monerod_detect;

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 monerod_detect;
mod proxy;
mod run_merge_miner;

Expand Down
Loading

0 comments on commit 3469b71

Please sign in to comment.