forked from ordinals/ord
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow pausing and resuming etchings (ordinals#3374)
- Loading branch information
1 parent
b109cec
commit 405cd35
Showing
18 changed files
with
840 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#[macro_export] | ||
macro_rules! define_table { | ||
($name:ident, $key:ty, $value:ty) => { | ||
const $name: TableDefinition<$key, $value> = TableDefinition::new(stringify!($name)); | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! define_multimap_table { | ||
($name:ident, $key:ty, $value:ty) => { | ||
const $name: MultimapTableDefinition<$key, $value> = | ||
MultimapTableDefinition::new(stringify!($name)); | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! tprintln { | ||
($($arg:tt)*) => { | ||
if cfg!(test) { | ||
eprint!("==> "); | ||
eprintln!($($arg)*); | ||
} | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! assert_regex_match { | ||
($value:expr, $pattern:expr $(,)?) => { | ||
let regex = Regex::new(&format!("^(?s){}$", $pattern)).unwrap(); | ||
let string = $value.to_string(); | ||
|
||
if !regex.is_match(string.as_ref()) { | ||
eprintln!("Regex did not match:"); | ||
pretty_assert_eq!(regex.as_str(), string); | ||
} | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! assert_matches { | ||
($expression:expr, $( $pattern:pat_param )|+ $( if $guard:expr )? $(,)?) => { | ||
match $expression { | ||
$( $pattern )|+ $( if $guard )? => {} | ||
left => panic!( | ||
"assertion failed: (left ~= right)\n left: `{:?}`\n right: `{}`", | ||
left, | ||
stringify!($($pattern)|+ $(if $guard)?) | ||
), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use super::*; | ||
|
||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] | ||
pub struct ResumeOutput { | ||
pub etchings: Vec<batch::Output>, | ||
} | ||
|
||
pub(crate) fn run(wallet: Wallet) -> SubcommandResult { | ||
let outputs: Result<Vec<batch::Output>> = wallet | ||
.pending_etchings()? | ||
.into_iter() | ||
.map(|(rune, entry)| { | ||
wallet.wait_for_maturation(&rune, entry.commit, entry.reveal, entry.output) | ||
}) | ||
.collect(); | ||
|
||
outputs.map(|etchings| Some(Box::new(ResumeOutput { etchings }) as Box<dyn Output>)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.