SHOWING: First 60
#66,849,480textpub(crate) use {
super::*,
bitcoin::{
blockdata::{opcodes, script, script::PushBytesBuf},
ScriptBuf, Witness,
},
pretty_assertions::assert_eq as pretty_assert_eq,
std::iter,
test_bitcoincore_rpc::TransactionTemplate,
unindent::Unindent,
};
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()) {
panic!(
"Regex:\n\n{}\n\n…did not match string:\n\n{}",
regex, string
);
}
};
}
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)?)
),
}
}
}
pub(crate) fn blockhash(n: u64) -> BlockHash {
let hex = format!("{n:x}");#45,010,933text Timestamp, WalletTxInfo,
},
jsonrpc_core::{IoHandler, Value},
jsonrpc_http_server::{CloseHandle, ServerBuilder},
serde::{Deserialize, Serialize},
server::Server,
state::State,
std::{
collections::{BTreeMap, BTreeSet, HashMap},
sync::{Arc, Mutex, MutexGuard},
thread,
time::Duration,
},
};
mod api;
mod server;
mod state;
pub fn builder() -> Builder {
Builder {
fail_lock_unspent: false,
network: Network::Bitcoin,
version: 240000,
}
}
pub struct Builder {
fail_lock_unspent: bool,
network: Network,
version: usize,
}
impl Builder {
pub fn fail_lock_unspent(self, fail_lock_unspent: bool) -> Self {
Self {
fail_lock_unspent,
..self
}
}
pub fn network(self, network: Network) -> Self {
Self { network, ..self }
}
pub fn version(self, version: usize) -> Self {
Self { version, ..self }
}
pub fn build(self) -> Handle {
let state = Arc::new(Mutex::new(State::new(
self.network,
self.version,
self.fail_lock_unspent,#44,994,427text