Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 47e688b

Browse files
committed
Release v0.1.5
1 parent 787417f commit 47e688b

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "GPL-3.0"
88
name = "atomicalsir"
99
readme = "README.md"
1010
repository = "https://github.com/hack-ink/atomicalsir"
11-
version = "0.1.4"
11+
version = "0.1.5"
1212

1313
[profile.ci-dev]
1414
incremental = false

src/main.rs

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -190,29 +190,16 @@ impl Wallet {
190190
}
191191

192192
async fn mine(&self, max_fee: u32, stash: Option<&str>, electrumx: Option<&str>) -> Result<()> {
193-
// #[derive(Debug, Deserialize)]
194-
// struct Satsbyte {
195-
// priority: u32,
196-
// }
197-
// let fee = reqwest::get("https://api.blockchain.info/mempool/fees")
198-
// .await?
199-
// .json::<Satsbyte>()
200-
// .await?
201-
// .priority + 5;
202-
#[derive(Debug, Deserialize)]
203-
#[serde(rename_all = "camelCase")]
204-
struct FastestFee {
205-
fastest_fee: u32,
206-
}
207-
let fee = reqwest::get("https://mempool.space/api/v1/fees/recommended")
208-
.await?
209-
.json::<FastestFee>()
210-
.await?
211-
.fastest_fee + 5;
193+
let fee = loop {
194+
if let Ok(f) = query_fee().await {
195+
break f;
196+
}
197+
};
212198

213199
tracing::info!("current priority fee: {fee} sat/vB");
214200

215-
let fee = fee.min(max_fee).to_string();
201+
// Add 5 more to increase the speed.
202+
let fee = (fee + 5).min(max_fee).to_string();
216203

217204
tracing::info!("selected: {fee} sat/vB");
218205

@@ -354,6 +341,29 @@ fn execute(
354341
Ok(())
355342
}
356343

344+
async fn query_fee() -> Result<u32> {
345+
// #[derive(Debug, Deserialize)]
346+
// struct Satsbyte {
347+
// priority: u32,
348+
// }
349+
// let fee = reqwest::get("https://api.blockchain.info/mempool/fees")
350+
// .await?
351+
// .json::<Satsbyte>()
352+
// .await?
353+
// .priority + 5;
354+
#[derive(Debug, Deserialize)]
355+
#[serde(rename_all = "camelCase")]
356+
struct FastestFee {
357+
fastest_fee: u32,
358+
}
359+
360+
Ok(reqwest::get("https://mempool.space/api/v1/fees/recommended")
361+
.await?
362+
.json::<FastestFee>()
363+
.await?
364+
.fastest_fee)
365+
}
366+
357367
fn kill(pid: u32) -> Result<()> {
358368
let pid = pid.to_string();
359369

0 commit comments

Comments
 (0)