Skip to content

Commit

Permalink
add --no-wait flag for making runes
Browse files Browse the repository at this point in the history
  • Loading branch information
rot13maxi committed Apr 17, 2024
1 parent e8084ba commit a635265
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/subcommand/wallet/batch_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl Batch {
mode: batchfile.mode,
no_backup: self.shared.no_backup,
no_limit: self.shared.no_limit,
no_wait: self.shared.no_wait,
parent_info,
postages,
reinscribe: batchfile.reinscribe,
Expand Down
1 change: 1 addition & 0 deletions src/subcommand/wallet/inscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl Inscribe {
mode: batch::Mode::SeparateOutputs,
no_backup: self.shared.no_backup,
no_limit: self.shared.no_limit,
no_wait: self.shared.no_wait,
parent_info: wallet.get_parent_info(self.parent)?,
postages: vec![self.postage.unwrap_or(TARGET_POSTAGE)],
reinscribe: self.reinscribe,
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/wallet/resume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub(crate) fn run(wallet: Wallet) -> SubcommandResult {
.pending_etchings()?
.into_iter()
.map(|(rune, entry)| {
wallet.wait_for_maturation(&rune, entry.commit, entry.reveal, entry.output)
wallet.wait_for_maturation(&rune, entry.commit, entry.reveal, entry.output, false)
})
.collect();

Expand Down
2 changes: 2 additions & 0 deletions src/subcommand/wallet/shared_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ pub(super) struct SharedArgs {
help = "Do not check that transactions are equal to or below the MAX_STANDARD_TX_WEIGHT of 400,000 weight units. Transactions over this limit are currently nonstandard and will not be relayed by bitcoind in its default configuration. Do not use this flag unless you understand the implications."
)]
pub(crate) no_limit: bool,
#[arg(long, alias = "nowait", help = "Do not wait for etching to mature.")]
pub(crate) no_wait: bool,
}
3 changes: 2 additions & 1 deletion src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,14 @@ impl Wallet {
commit: Transaction,
reveal: Transaction,
output: batch::Output,
no_wait: bool,
) -> Result<batch::Output> {
eprintln!("Waiting for rune commitment {} to mature…", commit.txid());

self.save_etching(rune, &commit, &reveal, output.clone())?;

loop {
if SHUTTING_DOWN.load(atomic::Ordering::Relaxed) {
if SHUTTING_DOWN.load(atomic::Ordering::Relaxed) || no_wait {
eprintln!("Suspending batch. Run `ord wallet resume` to continue.");
return Ok(output);
}
Expand Down
3 changes: 3 additions & 0 deletions src/wallet/batch/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct Plan {
pub(crate) mode: Mode,
pub(crate) no_backup: bool,
pub(crate) no_limit: bool,
pub(crate) no_wait: bool,
pub(crate) parent_info: Option<ParentInfo>,
pub(crate) postages: Vec<Amount>,
pub(crate) reinscribe: bool,
Expand All @@ -28,6 +29,7 @@ impl Default for Plan {
mode: Mode::SharedOutput,
no_backup: false,
no_limit: false,
no_wait: false,
parent_info: None,
postages: vec![Amount::from_sat(10_000)],
reinscribe: false,
Expand Down Expand Up @@ -151,6 +153,7 @@ impl Plan {
self.inscriptions.clone(),
rune.clone(),
),
self.no_wait,
)?)))
} else {
let reveal = match wallet
Expand Down

0 comments on commit a635265

Please sign in to comment.